[Python-ideas] [Python-Dev] datetime module enhancements

Jim Jewett jimjjewett at gmail.com
Mon Mar 12 16:43:18 CET 2007


On 3/12/07, Christian Heimes <lists at cheimes.de> wrote:
> datetime before date: <
> datetime during date: in
> datetime after date: >

> datetime <= date and datetime => date should raise a TypeError. The
> result is ambiguous. A date with time is never equal to a date.

As a practical matter, sorting uses <=

I would be somewhat annoyed if

    dt < d

were True, but when I tried to sort them,

    dt <= d

raised a TypeError.

It would be OK with me to raise an error (ValueError?) on "dt <= d" if
"dt in d".   Others might feel differently, and prefer to always get
the TypeError -- which is probably why dt<t doesn't already do the
obvious thing.

-jJ



More information about the Python-ideas mailing list