In previous versions of
shutil.make_archive, we needed to temporarily switch the current working directory to archive file/directory (e.g.
xztar, etc.) to its relative paths - similar to the following shell pattern:
Now we can just pass the new
This is one of my favorite new features. In UNIX, the
tempfile.NamedTemporaryFile generates a random file under the
/tmp directory to facilitate ephemeral writes and reads (like caching). However, in the old days, we needed to keep track of the filenames if we ever wanted to manually delete them. With the new
delete_on_close boolean parameter, we can now offload this responsibility with
In this version, a new flag to
os.pidfd_open(pid: int, flags: int) has been added to expose
PIDFD_NONBLOCK to Python (a.k.a. opening a file descriptor to a running process in a non-blocking mode).
Not sure what I’ll be using this for yet, but will be keeping it in mind.
Instead of doing this:
We can just do this:
I use these type hint notations in my codebase - but with
3.12, the naming convention has been changed to
asyncio.get_event_loop(), which returns the event loop of the current async context, will now
DeprecationWarning if there is no context event loop.
runtime_checkable decorator will now freeze the members of
From Unicode objects, the
wstr_length have been removed. This reduces the object size by 8 or 16 Bytes on 64-bit platforms.
Great news for regular expression lovers like myself! Regex-based substitutions will be faster by 2~3x for expressions containing group references (like
perf profilers will now report function names in the trace logs.