[Datetime-SIG] PEP-495 - Strict Invalid Time Checking

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue Aug 25 23:47:52 CEST 2015


On Tue, Aug 25, 2015 at 5:44 PM, Carl Meyer <carl at oddbird.net> wrote:

> On 08/25/2015 03:36 PM, Alexander Belopolsky wrote:
> >
> > On Tue, Aug 25, 2015 at 5:28 PM, Carl Meyer <carl at oddbird.net
> > <mailto:carl at oddbird.net>> wrote:
> >>
> >> My answer is "only in those same locations where the fold attribute
> >> would otherwise be checked in order to resolve an ambiguity."
> >
> >
> > This includes utcoffset() which is used in datetime.__eq__.  What should
> > __eq__ do if utcoffset() raises AmbiguousTimeError?  Unpatched, it will
> > propagate the exception resulting in for example x in [y, x, x, x]
> > raising an error whenever y happened to be fold=-1 ambiguous.  Is your
> > code prepared to handle  AmbiguousTimeError whenever you search for a
> > date in a list?  Does it check for fold != -1 before adding a date to a
> > list?
>
> This is a good question. I can see two defensible choices:


Pick one and try to defend it.  In the face of ambiguity ...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20150825/d0bde8bc/attachment.html>


More information about the Datetime-SIG mailing list