[Python-ideas] bool(datetime.time(0, 0))

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue May 8 20:30:39 CEST 2012


On Tue, May 8, 2012 at 1:11 PM, Guido van Rossum <guido at python.org> wrote:
> At the same time knowing what I know
> now about common usage I wouldn't design it this way today.

I agree with this.  Note that the latest addition to the datetime
module - the timezone type is designed differently:

>>> bool(timezone.utc)
True

In many ways the timezone type is similar to time: it represents a
point on a 24-hour circle.  Even though the "zero" timezone is even
more special than midnight, the potential for a coding mistake testing
for truth instead of identity with None is even greater because None
is (unfortunately) a very common value for tzinfo.

I still don't think we can change bool(time(0)), though.



More information about the Python-ideas mailing list