[Datetime-SIG] PEP 495 (Local Time Disambiguation) is ready for pronouncement

Ethan Furman ethan at stoneleaf.us
Tue Aug 18 21:22:40 CEST 2015

On 08/18/2015 12:09 PM, Ethan Furman wrote:
> On 08/18/2015 11:41 AM, Alexander Belopolsky wrote:
>> 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.
> I don't understand this.  In the PEP it says:
>> An instance that has first=False in a non-ambiguous case is said to represent
>>  an invalid time (or is invalid for short), but users are not prevented from
>>  creating invalid instances by passing first=False to a constructor or to a
>>  replace() method.
> and later
>> The value of "first" will be ignored in all operations except those that
>>  involve conversion between timezones.
> So why won't `t.replace(_ltdf=True)` be the same value as `t.replace(_ltdf=False)` ?  The flag itself would be different, but the flag is not consulted for maths operations, right?

Ah, puzzling through the PEP again I think you just left off the `.timestamp()` from those two pieces.


More information about the Datetime-SIG mailing list