[Python-ideas] datetime module enhancements
jimjjewett at gmail.com
Tue Mar 13 02:17:06 CET 2007
On 3/12/07, Steven Bethard <steven.bethard at gmail.com> wrote:
> On 3/12/07, Christian Heimes <lists at cheimes.de> wrote:
> > Steven Bethard schrieb:
> > >> datetime <= date and datetime => date should raise a TypeError. The
> > >> result is ambiguous. A date with time is never equal to a date.
But it can still be <=, by being <.
I would personally be OK with just saying that (year, month, day)
sorts less than (year, month, day, ...) regardless of time, simply
because of the type -- but I admit that would be arbitrary.
> Fair enough. My only point was that as long as __lt__ is defined,
> __le__ can throw a TypeError() and it won't break sorted().
Mea culpa. I was mis-remembering, and thought that even this would
break because of sort stability.
More information about the Python-ideas