datetime.time and midnight

Mark Dickinson dickinsm at gmail.com
Sun Feb 22 04:47:54 EST 2009


On Feb 22, 9:18 am, Mark Dickinson <dicki... at gmail.com> wrote:
> On Feb 21, 10:44 pm, Ethan Furman <et... at stoneleaf.us> wrote:
>
> > --> midnight = datetime.time(0,0,0)
> > --> bool(midnight)
> > False
>
> I'd call this a bug.

...although looking at the source (see the function
time_nonzero in Modules/datetimemodule.c), this
behaviour is clearly intentional.  So it's not a bug;
merely a questionable design decision.  :)

Mark




More information about the Python-list mailing list