[Datetime-SIG] PEP 495 (Local Time Disambiguation) is ready for pronouncement
carl at oddbird.net
Tue Aug 18 20:54:11 CEST 2015
On 08/18/2015 12:41 PM, Alexander Belopolsky wrote:
> On Tue, Aug 18, 2015 at 2:22 PM, Carl Meyer <carl at oddbird.net
> <mailto:carl at oddbird.net>> wrote:
> But I still think I could figure out whether to use later=True or
> later=False more easily than I could figure out whether to use fold=True
> or fold=False (in both cases really, but especially in the gap case).
> I am not sure Raymod Hettinger is receiving these emails, so I added him
> to "bcc". It will be good to have an input from people with teaching
> experience. The problem with "hardcoding" the temporal relationship in
> the name of the flag is that for a missing time `t` you get a
> counter-intuitive t.replace(later=True) - t.replace(later=False) < 0.
> On one hand, this strongly suggests that something is wrong with `t`,
> but also invites a question why not make this an error? A "gap" is a
> negative "fold" rule may not be much better in terms of teachability,
> but it is hard to judge it without an actual teaching experience.
`t.replace(later=True) - t.replace(later=False) < 0` certainly seems
wrong, but why would it be implemented that way?
I now see that your PEP text specifies the same "backwards from the
plain sense of the flag" behavior with `first` as the flag: "The value
returned by dt.timestamp() given a missing dt will be the larger of the
two "nice to know" values if dt.first == True and the smaller otherwise."
Why not simply flip the sense of that sentence so that `later` always
means the later of the two possible resolutions?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: OpenPGP digital signature
More information about the Datetime-SIG