Python discoveries of the day

less than 1 minute read

Python discoveries of the day.

f-string debug specifier (=)

Check:

>>> f"hey {randint(0,20)=} {foo=}"
'hey randint(0,20)=0 foo=18'

Now debug lines can be more expressive, instead of

    f"Processing finished for task {task!r}"

One can write:

    f"Processing finished for {task=}"

Slightly different output but does the job.

Asyncio introspection capabilities (>=3.14)

See What’s new in Python 3.14.

python -m asyncio ps PID

python -m asyncio pstree PID

Updated: