Post #621934
2026-03-07 23:58 UTC
I saw a TIL post on bsky today about using '/' with pathlib.Path's. Some other features recently added to #python
- itertools.batched (3.12)
- accessing re.Match groups using m[1] notation (faster than calling m.group(1)) (3.6)
- 1_000_000 is a legal syntax for 1000000 (3.6)
- command-line access to stdlib modules (python -m <name>)
- uuid (3.12)
- json (3.14)
- random (3.13)
- sqlite3 (3.12)
- http.server (3.4)
- f-strings (3.6)
- true multithreading (3.14)
- contextlib.chdir (3.11)
Replies (3)
-
@ptmcg@fosstodon.org 2026-03-08 00:36
And these simplifications to type hints: - typing simplifications - List, Dict, Tuple, etc. -> list, dict, and tuple (3.9) - Union[X, Y] and Optional[X] -> X|Y and X|None (3.10) - no more class Z(Generic[T]), just class Z[T] (3.12) - also def last[T](seq: Sequence[T]) -> T (3.12) - 'type' as a statement (3.12)
-
@MissingClara@chaos.social 2026-03-08 01:21
@ptmcg@fosstodon.org my personal favorite development from the past couple years has been moving f-strings to the grammar parser in 3.12 (PEP 701), which now allows using the same type of quotes inside an f-string that uses that quote type (eg. f'foo{'bar'}')
-
@zauberlaus@chaos.social 2026-03-08 05:49
@ptmcg@fosstodon.org sorry what do you mean with - json ? that module is certainly older than 3.14?