[Datetime-SIG] PEP 495 (Local Time Disambiguation) is ready for pronouncement
lrekucki at gmail.com
Mon Aug 17 12:23:30 CEST 2015
On Sunday, August 16, 2015, Alexander Belopolsky <
alexander.belopolsky at gmail.com> wrote:
> PEP 495  is a deliberately minimalistic proposal to remove an
> ambiguity in representing some local times as datetime.datetime
I'm quite confused - I though that all this discussion about terminology
ended with agreement that the current datetime object is a good
representation of naive time (aka LocalDateTime in other libraries). That
time is never ambiguous because it has no timezone to begin with.
I'm also not sure what purpose adding this flag to time object has. I know
it has a tzinfo, but it's obviously impossible to have a dst aware
implementation working with that.
> The concept has been extensively discussed on python-ideas and this
> mailing list. I believe a consensus has been reached and it is
> reflected in the PEP.
A middle of summer vacations is not the best time to reach a consensus on
anything ;) I'm not asking for special treatment, but as Python 3.6 is
months away, maybe this could wait a week or two more.
> PEP 495 does not propose any changes to datetime/timedelta
> arithmetics, but it has been agreed that it is a necessary step for
> implementing the "strict" rules.
Without a clear view what are the next steps with this approach, I think it
might harm the final solution because it introduces even more things to be
backward compatible about.
I would like to propose an alternate solution. Instead of a flag, I propose
to add a "zone offset" property. This would be a read-only property that is
assigned by tzinfo when converting to that timezone (and possibly when
This solves the problem of overlapping moments, doesn't depend on the gap
being 60 minutes or having external knowledge about it and allows for
simple convention to UTC.
Instead of adding more arguments to constructor and replace(), I propose
add two methods to datetime:
That would delegate to tzinfo the task to produce a datetime instance that
matches the requested moment in time. When parsing strings, earlier would
be always chosen and user can adjust to their preference. For all current
implementations those would be a no-ops.
I hope this actually makes any sense to you. I don't have such great
writing skills to produce a PEP so quickly (especially on a phone). If no,
just ignore this message ;)
> : https://www.python.org/dev/peps/pep-0495
> Datetime-SIG mailing list
> The PSF Code of Conduct applies to this mailing list:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Datetime-SIG