From 9b5d44c5631146d08bc1e042d5ab6524fa6fa36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Tue, 12 Mar 2024 07:46:17 +0100 Subject: [PATCH] Regex, Type annotations --- README.md | 8 ++++---- index.html | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a5e167f..a6fd74e 100644 --- a/README.md +++ b/README.md @@ -359,7 +359,7 @@ import re = re.finditer(r'', text) # Returns all occurrences as Match objects. ``` -* **Raw string literals do not interpret escape sequences, thus enabling us to use regex-specific escape sequences that cause SyntaxWarning in normal string literals.** +* **Raw string literals do not interpret escape sequences, thus enabling us to use regex-specific escape sequences that cause SyntaxWarning in normal string literals (since 3.12).** * **Argument 'new' of re.sub() can be a function that accepts a Match object and returns a str.** * **Argument `'flags=re.IGNORECASE'` can be used with all functions.** * **Argument `'flags=re.MULTILINE'` makes `'^'` and `'$'` match the start/end of each line.** @@ -1026,9 +1026,9 @@ class C(A, B): pass ```python from collections import abc -: [| ...] [= ] -: list/set/abc.Iterable/abc.Sequence[] [= ] -: dict/tuple[, ...] [= ] +: [| ...] [= ] # `|` since 3.10. +: list/set/abc.Iterable/abc.Sequence[] [= ] # Since 3.9. +: dict/tuple[, ...] [= ] # Since 3.9. ``` ### Dataclass diff --git a/index.html b/index.html index 0541e71..26c9a21 100644 --- a/index.html +++ b/index.html @@ -335,7 +335,7 @@ Point(x=1, y=2
    -
  • Raw string literals do not interpret escape sequences, thus enabling us to use regex-specific escape sequences that cause SyntaxWarning in normal string literals.
  • +
  • Raw string literals do not interpret escape sequences, thus enabling us to use regex-specific escape sequences that cause SyntaxWarning in normal string literals (since 3.12).
  • Argument 'new' of re.sub() can be a function that accepts a Match object and returns a str.
  • Argument 'flags=re.IGNORECASE' can be used with all functions.
  • Argument 'flags=re.MULTILINE' makes '^' and '$' match the start/end of each line.
  • @@ -864,9 +864,9 @@ Z = dataclasses.make_dataclass('Z', [Hints are used by type checkers like mypy, data validation libraries such as Pydantic and lately also by Cython compiler. However, they are not enforced by CPython interpreter.
from collections import abc
 
-<name>: <type> [| ...] [= <obj>]
-<name>: list/set/abc.Iterable/abc.Sequence[<type>] [= <obj>]
-<name>: dict/tuple[<type>, ...] [= <obj>]
+<name>: <type> [| ...] [= <obj>]                              # `|` since 3.10.
+<name>: list/set/abc.Iterable/abc.Sequence[<type>] [= <obj>]  # Since 3.9.
+<name>: dict/tuple[<type>, ...] [= <obj>]                     # Since 3.9.