[Datetime-SIG] PEP 495: What's left to resolve

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue Sep 8 18:19:59 CEST 2015


On Tue, Sep 8, 2015 at 11:46 AM, Alexander Belopolsky <
alexander.belopolsky at gmail.com> wrote:

> it breaks the rule that for fold=0 nothing changes.


We may need a new section in the PEP explaining the differences between
pre-PEP and post-PEP tzinfo implementations.  For example, it is not true
that post-PEP utcoffset() will return the same value on a fold=0 instance
as a pre-PEP does.   The pre-PEP rule is to treat both ambiguous (fold) and
missing (gap) times as "standard time".  In the typical DST observing
timezone that alternated between STD and DST, this means that pre-PEP rule
treats fold times as fold=1 and gap times as fold=0.  For more complicated
situations where you can see two folds or two gaps in a row or a time shift
without a DST change (a change in STD offset), no rule is currently
specified.

The existing rules for fold/gap disambiguation are formulated for a single
purpose: to make the generic fromutc() implementation work for the US-style
timezones.  Since PEP 495 requires that the new tzinfo implementations
reimplement their own fromutc(), we decided that we are free to formulate
new gap/fold disambiguation rules.

The PEP 495 rules are formulated to be more rational than those that were
dictated by the fromutc() implementation.  For example, defaulting to the
first time in the fold seems more natural and a wise choice: it the worst
case you will have to kill an hour before the odd time meeting, but you
won't miss it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20150908/84dd9435/attachment.html>


More information about the Datetime-SIG mailing list