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

Collin Winter collinw at gmail.com
Mon Mar 12 20:01:55 CET 2007

On 3/12/07, Collin Winter <collinw at gmail.com> wrote:
> On 3/12/07, Steven Bethard <steven.bethard at gmail.com> wrote:
> > [I'm not on this list, so please keep me in the CC if you reply]
> >
> > That's a nice idea.  With the simplest implementation, you could then
> > guarantee that one of the following would always be true::
> >
> >     datetime < date
> >     datetime in date
> >     datetime > date
> >
> > (That would actually conflate the Starts, Finishes and During
> > relations in the __contains__ operator, but I think that's a perfectly
> > reasonable interpretation, and I know it would be useful in my code at
> > least.)
> I'll work up a patch.

Posted as #1679204 (http://python.org/sf/1679204). In addition to
date.__contains__, I had to add a datetime.__contains__ that throws a
TypeError (since datetime inherits from date).

While writing the patch, I had the idea of making "time in date"
always return True, but I'm not sure that would be useful.

Collin Winter

More information about the Python-ideas mailing list