PEP 615: Support for the IANA Time Zone Database in the Standard Library

Would WeakValueDictionary be a more straightforward example?

This means print(zone) would print nothing, which is quite confusing. Why not fall back to <ZoneInfo object at 0x...>? ISTM that’s also always an invalid key.

As an employee of Red Hat, I feel obliged to point out that it’s spelled with a space, and that it’s a company, not a distro. Instead of “Red Hat Enterprise Linux” (or RHEL), I recommend giving Fedora as an example. (IMO new CPython features should target community distros.)

What’s the use case for PYTHONTZPATH_APPEND?

Either the signature is missing = None, or you can’t call it with no arguments.
Neither set_tzpath() not set_tzpath(None) look like they’re resetting the path. Have you considered a separate reset_tzpath() to make the effect clear?

To discourage setting global state, and to make tests or hotfixy workarounds more robust, can tzpaths also be an argument to ZoneInfo (with the same caching caveat as set_tzpath) or ZoneInfo.nocache?

1 Like