
On Fri, Jan 19, 2018 at 12:53 PM, Paul G paul@ganssle.io wrote:
That said, it's still somewhat glaring in its absence. Thinking about it, though, I think it's not at all unreasonable to include a zoneinfo *parser* into Python's `datetime` library, something similar to `dateutil.tz.tzfile`
A variant of tzfile is in fact included, but buried in the datetime tester. Unfortunately, binary tz files distributed with many UNIX-like OSes do not preserve enough information to implement a high quality Python tzinfo subclass. The missing information is the breakdown of utcoffset into standard offset and dst. The tz files only store DST as a boolean and in the rare cases when DST differs from 1 hour, it is impossible to accurately figure out the .dst() timedelta.
If we go to the trouble of implementing a Zoneinfo parser, I suggest that we also include a parser for the raw IANA files that can extract the DST timedelta information from the "SAVE" field.
Note that I started toying with some related ideas at https://github.com/abalkin/tz.