[Python-Dev] datetime module enhancements

Collin Winter collinw at gmail.com
Sat Mar 10 20:42:08 CET 2007


On 3/10/07, Robert Brewer <fumanchu at amor.org> wrote:
> On 3/9/07, Collin Winter <collinw at gmail.com> wrote:
>  > > On the subject of datetime enhancements, I came
>  > > across an SF patch (#1673403) the other day that
>  > > proposed making it possible to compare date and
>  > > datetime objects.
>  >
>  > One solution that just occurred to me -- and that
>  > skirts the issue of choosing an interpretation --
>  > is that, when comparing date and datetime objects,
>  > the datetime's .date() method is called and the
>  > result of that call is compared to the original
>  > date. That is,
>  >
>  > datetime_obj < date_obj
>  >
>  > is implicitly equivalent to
>  >
>  > datetime_obj.date() < date_obj
>  >
>  > Seems a ready-made use case for that method.
>
>  +1
>
>  ...and it's a decision that can be made independently
>  of how to add or subtract dates.

That's what I thought, until Steve Bethard set me straight:
http://mail.python.org/pipermail/python-dev/2007-March/071803.html

I'm going to defer to him on this.

Collin Winter


More information about the Python-Dev mailing list