[Datetime-SIG] Equality of tzinfo objects

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Nov 3 14:24:41 EDT 2016


On Thu, Nov 3, 2016 at 2:09 PM, Paul G <paul at ganssle.io> wrote:

> I don't understand why it must be the case that something is considered an
> "inter-zone" comparison whenever `t.tzinfo is not s.tzinfo`. What is the
> objection to using `t.tzinfo != s.tzinfo` as the criterion? In general
> these will be equivalent, but using __eq__ allows time zone providers to
> determine what is considered an "inter-zone" comparison.


This was probably the case of premature optimization.  I cannot think of
any valid reason, but datetime comparisons have always compared tzinfos
using "is" rather than "==" operator.   We can probably still make a
change, but it should be implemented and thoroughly tested first.  Please
open a bug report.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20161103/7aa140a7/attachment.html>


More information about the Datetime-SIG mailing list