[Python-Dev] Mixed-type datetime comparisons

Tim Peters tim@zope.com
Sat, 25 Jan 2003 14:25:22 -0500


[TIm]
> Note that this doesn't help for mixed-type time or timedelta comparison:
> datetime's time and timedelta objects don't have timetuple methods
> themselves, and their comparison implementations still raise TypeError
> whenever they don't recognize the other comparand's type (this
> is needed to prevent comparison against objects of arbitrary types from
> falling back to the default comparison of object addresses).

[M.-A. Lemburg]
> Why not add them (setting the date parts to None) ?

Because they're of no use, and at least timedelta.timetuple() wouldn't even
make hallucinogenic sense (a timetuple is in units of days, seconds and
microseconds).