[ python-Bugs-1673405 ] None-datetime comparison doesn't work

SourceForge.net noreply at sourceforge.net
Sun Mar 4 19:48:14 CET 2007


Bugs item #1673405, was opened at 2007-03-04 06:52
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1673405&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
>Group: Feature Request
>Status: Closed
>Resolution: Rejected
Priority: 5
Private: No
Submitted By: Jon Ribbens (jribbens)
Assigned to: Nobody/Anonymous (nobody)
Summary: None-datetime comparison doesn't work

Initial Comment:
Comparing None to the objects in the datetime module throws an exception. This violates the general rule in Python that None compares "less than" everything else.

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2007-03-04 13:48

Message:
Logged In: YES 
user_id=31435
Originator: NO

There is no such rule, and it's quite deliberate that the newer types
(like datetime objects and sets) raise an exception on mixed-type
inequality comparisons.  For older types, the result of inequality
comparison with None isn't defined by the language, and the outcome does
vary across CPython releases.

Rejecting this, since the code is working as designed and documented (see,
e.g., footnote (4) in the datetime docs:  "Note: In order to stop
comparison from falling back to the default scheme of comparing object
addresses, datetime comparison normally raises TypeError if the other
comparand isn't also a datetime object. However, ...").

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1673405&group_id=5470


More information about the Python-bugs-list mailing list