Message83798
While the datetime.date and datetime.datetime classes consistently
handle mixed-type comparison, their subclasses do not:
>>> from datetime import date, datetime, time
>>> d = date.today()
>>> dt = datetime.combine(d, time())
>>> d == dt
False
>>> dt == d
False
>>> class D(date):
... pass
...
>>> class DT(datetime):
... pass
...
>>> d = D.today()
>>> dt = DT.combine(d, time())
>>> d == dt
True
>>> dt == d
False
I think this is due to the premature "optimization" of using memcmp() in
date_richcompare(). |
|
Date |
User |
Action |
Args |
2009-03-19 00:51:27 | jess.austin | set | recipients:
+ jess.austin |
2009-03-19 00:51:26 | jess.austin | set | messageid: <1237423886.27.0.985547007127.issue5516@psf.upfronthosting.co.za> |
2009-03-19 00:51:23 | jess.austin | link | issue5516 messages |
2009-03-19 00:51:22 | jess.austin | create | |
|