[Python-ideas] datetime module enhancements

Steven Bethard steven.bethard at gmail.com
Mon Mar 12 19:06:15 CET 2007

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.
> >
> > Jim Jewett wrote:
> >> As a practical matter, sorting uses <=
> >
> > Are you sure?
> It depends what tp slot is defined. The C api supports either comparison
> (cmp style -1, 0, 1) or rich comparison (func(self, other, operator)).

Fair enough.  My only point was that as long as __lt__ is defined,
__le__ can throw a TypeError() and it won't break sorted().

I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy

More information about the Python-ideas mailing list