From 9d2c4ea94d77ac748baef81a342b2025503950f1 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 26 Sep 2024 23:30:17 +0200 Subject: [PATCH 1/2] Fix issue in a code example --- content/posts/python-type-checking.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/content/posts/python-type-checking.md b/content/posts/python-type-checking.md index 440b0a9..b2b520e 100644 --- a/content/posts/python-type-checking.md +++ b/content/posts/python-type-checking.md @@ -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 From 8dff92eae9856c40f10596d7be33b433ea8c94d7 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Mon, 10 Mar 2025 23:00:26 +0100 Subject: [PATCH 2/2] Fix formatting typo in great-commits page --- content/posts/great-commits.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/posts/great-commits.md b/content/posts/great-commits.md index 58c5fdd..768465a 100644 --- a/content/posts/great-commits.md +++ b/content/posts/great-commits.md @@ -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