[Datetime-SIG] PEP 495: The classify() method

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Sep 10 00:19:08 CEST 2015

On Wed, Sep 9, 2015 at 5:10 PM, Tim Peters <tim.peters at gmail.com> wrote:
[in the "Making dt parameter of timezone.tzname(dt) optional" thread]
> Only if PEP 495 adds an obviously needed tzifno.classify(self, dt)
> method so that ordinary users don't have to become implementation
> experts to answer questions about datetimes that aren't about
> implementation details ;-)

Deal!  But the return values of classify() should be -1 (for gap), 0 (for
regular) and 1 (for fold).  And while we are at it, let's  bring back the
builtin cmp() method because all these cryptic >, < and == are just too
confusing. :-)

Seriously, though, I have no objection to the classify() method, but
someone else will have to design it and carry through the unavoidable
bikeshedding rounds.

My goal in PEP 495 is to draw a straight line between the current state of
affairs and a lossless astimezone().  Niceties like classify() are just a
little off that path.

I had no illusions when I started PEP 495 that it would be as easy as it
sounds (just add one measly bit!)  Still, I did not anticipate all the
subtle issues that would have to be resolved.

So rather than proposing more features that are not strictly necessary, I
would like to ask the group to start kicking the tires on the reference
implementation. [1]

[1]: https://github.com/abalkin/cpython/tree/issue24773-s3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20150909/30b304f3/attachment.html>

More information about the Datetime-SIG mailing list