Thanks for the comments, I'll update the proposal in response. My
responses are here:
* Having global state can lead to problems (even in single-threaded apps), and this proposal has global state in the implementation of the 'set_tzpath' function. Instead of that function, how about an optional argument to the ZoneInfo constructors? The optional argument would specify the path for apps that don't want the default path. Then apps wouldn't need set_tzpath.
Basically, both the mutable global state and the constructor
argument have undesirable interactions with the caching behavior
of the main constructor (and dropping the caching behavior would
cause worse problems). My position is that you probably shouldn't
call set_tzpath except in specific situations like tests or "call
it once in main() before anything else has run", and that a free
function that mutates the global state accomplishes this better
and encourages people not to make a bunch of calls to the
constructor with inconsistent search paths.
I'm amenable to dropping the whole thing, though, TBH.
* The proposal is silent on the issue of what happens during updates to tzdata files while a Python program is running. Should this update be reflected immediately in all Python-level calls? Should it wait until the next call to ZoneInfo on the affected zone, which means that zones are not immutable? Should the update be ignored and the program proceed as if the update hasn't happened? Or are all these valid implementations of the spec? Whichever you decide, the decision should be written down so that developers are put on notice.
* How do I get tzdata-based leap second support, if I want it? Or are leap seconds specifically out of scope?
Beyond the fact that I plan to ship non-"zone" files in the
tzdata fallback package (and thus include the leap seconds), leap
seconds are out of scope for this proposal. Python's datetime type
has no support for leap seconds currently, and other than being
tracked in the same database, I think they're at least somewhat
orthogonal to the primary problem we're solving here (a tzinfo
implementation).
Leap second support is on my long list of improvements for the
datetime module, so I'll probably get around to it at some point
in the future.
I have had another query about leap seconds, so I'll probably want
to add to the proposal that it's out of scope.
* You might want to mention TZDIST (RFC 7808) as an alternative source for tzdata that a Python implementation could use instead of TZif files in a local filesystem.
In any case, thanks so much for the comments, you've given me a
lot of food for thought already!
Best,
Paul