he/him - Author/maintainer of #pyparsing, #littletable, #plusminus - I do digital art when I get the time. Co-author of "Python in a Nutshell, 4th Ed". PSF Fellow. Avatar: NAT #python #pynutshell4
he/him - Author/maintainer of #pyparsing, #littletable, #plusminus - I do digital art when I get the time. Co-author of "Python in a Nutshell, 4th Ed". PSF Fellow. Avatar: NAT #python #pynutshell4
Posts
he/him - Author/maintainer of #pyparsing, #littletable, #plusminus - I do digital art when I get the time. Co-author of "Python in a Nutshell, 4th Ed". PSF Fellow. Avatar: NAT #python #pynutshell4
he/him - Author/maintainer of #pyparsing, #littletable, #plusminus - I do digital art when I get the time. Co-author of "Python in a Nutshell, 4th Ed". PSF Fellow. Avatar: NAT #python #pynutshell4
he/him - Author/maintainer of #pyparsing, #littletable, #plusminus - I do digital art when I get the time. Co-author of "Python in a Nutshell, 4th Ed". PSF Fellow. Avatar: NAT #python #pynutshell4
@catsalad@infosec.exchange It's not 1 but 2 characters: _· This is a legal variable name in Python. The second character is the Unicode MIDDLE DOT. It is only legal as a body character, not an initial character, so you need the leading "_".
he/him - Author/maintainer of #pyparsing, #littletable, #plusminus - I do digital art when I get the time. Co-author of "Python in a Nutshell, 4th Ed". PSF Fellow. Avatar: NAT #python #pynutshell4
@zauberlaus@chaos.social It is one of a few stdlib modules that have added command-line functionality, along with uuid, random, sqlite3, etc. json is a little different because it previously released the json.tool command-line function, but now in 3.14 it is exposed as just json, so python -m json - a Python version of jq.
he/him - Author/maintainer of #pyparsing, #littletable, #plusminus - I do digital art when I get the time. Co-author of "Python in a Nutshell, 4th Ed". PSF Fellow. Avatar: NAT #python #pynutshell4
@tartley@fosstodon.org Thanks for posting the article. asyncio has been off my radar for a while, but I'm delving into it more and more these days. Another recent addition is asyncio.to_thread(). It's a nice way to async-ify a synchronous call, though its really just a convenience form of asyncio.run_in_executor(). I've looked at TaskGroup a little, but I'll revisit after I read your article in a little more depth.
he/him - Author/maintainer of #pyparsing, #littletable, #plusminus - I do digital art when I get the time. Co-author of "Python in a Nutshell, 4th Ed". PSF Fellow. Avatar: NAT #python #pynutshell4
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)
he/him - Author/maintainer of #pyparsing, #littletable, #plusminus - I do digital art when I get the time. Co-author of "Python in a Nutshell, 4th Ed". PSF Fellow. Avatar: NAT #python #pynutshell4
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 )
- 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)
he/him - Author/maintainer of #pyparsing, #littletable, #plusminus - I do digital art when I get the time. Co-author of "Python in a Nutshell, 4th Ed". PSF Fellow. Avatar: NAT #python #pynutshell4
he/him - Author/maintainer of #pyparsing, #littletable, #plusminus - I do digital art when I get the time. Co-author of "Python in a Nutshell, 4th Ed". PSF Fellow. Avatar: NAT #python #pynutshell4
he/him - Author/maintainer of #pyparsing, #littletable, #plusminus - I do digital art when I get the time. Co-author of "Python in a Nutshell, 4th Ed". PSF Fellow. Avatar: NAT #python #pynutshell4
Here are some emojidentifiers for your next Python code:
import math
乁_ツ_ㄏ = None
乁_益_ㄏ = math.nan
ఠ_ఠ = isinstance
def minnums(values: list | 乁_ツ_ㄏ = 乁_ツ_ㄏ):
if (
values is 乁_ツ_ㄏ
or not all(ఠ_ఠ(n, (float, int))
for n in values)
):
return 乁_益_ㄏ
return min(values)