Compare commits

...

2 commits

Author SHA1 Message Date
8dff92eae9
Fix formatting typo in great-commits page 2025-03-10 23:00:26 +01:00
9d2c4ea94d
Fix issue in a code example 2024-09-26 23:30:17 +02:00
2 changed files with 7 additions and 7 deletions

View file

@ -112,7 +112,7 @@ Git commits should be written in a very specific way. There's a few rules to fol
having trouble summarizing, you might be committing too much at once)
- **Capitalize the subject line**
- **Don't end the subject line with a period**
- \*Use imperative mood in subject\*\* (Imperative mood means "written as if giving a command/instruction" i.e.: "Add
- **Use imperative mood in subject** (Imperative mood means "written as if giving a command/instruction" i.e.: "Add
support for X", not "I added support for X" or "Support for X was added", as a rule of thumb, a subject message
should be able to complete the sentence: "If implemented, this commit will ...")
- **Wrap body at 72 characters** (We usually use `git log` to print out the commits into the terminal, but it's output

View file

@ -297,7 +297,7 @@ def print_items(lst: list[str]) -> None:
# The type-checker knows `item` variable is a string now
print(f"-> Item #{index}: {item.strip()}")
print_items([1, 2, 3])
print_items(["hi", " hello ", "hey "])
```
That said, in many cases, instead of using these specific collection types, you can use a less specific collection, so
@ -312,12 +312,12 @@ def print_items2(lst: Sequence[str]) -> None:
# The type-checker knows `item` variable is a string now
print(f"Item #{index}: {item.strip()}")
print_items([1, 2, 3]) # fine
print_items((1, 2, 3)) # nope
print_items(["a", "b", "c"]) # fine
print_items(("a", "b", "c")) # nope
print_items2([1, 2, 3]) # works
print_items2((1, 2, 3)) # works
print_items2({1, 2, 3}) # works
print_items2(["a", "b", "c"]) # works
print_items2(("a", "b", "c")) # works
print_items2({"a", "b", "c"}) # works
```
You may think that you could also just use a union like: `list[str] | set[str] | tuple[str, ...]`, however that still