[Python-Dev] PEP 495 accepted (original) (raw)
Guido van Rossum guido at python.org
Tue Sep 22 18:38:22 CEST 2015
- Previous message (by thread): [Python-Dev] PEP 495 accepted
- Next message (by thread): [Python-Dev] PEP 495 accepted
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Sep 22, 2015 at 8:16 AM, Tim Peters <tim.peters at gmail.com> wrote:
[Tim] > ... > The > top-level operation on the RHS is datetime.fromtimestamp(). However, > it didn't pass a tzinfo, so it creates a naive datetime. Assuming dt > was aware to begin with, the attempt to compare will always (gap or > not) raise an exception.
Oops! In current Python, comparing naive and aware via
==
just returns False. That's even more confusing ;-)
Hm, but that's in general how == is supposed to work between objects of incompatible types. < and > are supposed to fail but == is supposed to return False (the eq should return NotImplemented). If == ever raises an exception, having two different objects as dict keys can cause random, hard-to-debug failures.
-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150922/f2f16933/attachment-0001.html>
- Previous message (by thread): [Python-Dev] PEP 495 accepted
- Next message (by thread): [Python-Dev] PEP 495 accepted
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]