[Python-ideas] Please reconsider the Boolean evaluation of midnight

Bruce Leban bruce at leapyear.org
Thu Mar 6 06:16:49 CET 2014


On Wed, Mar 5, 2014 at 8:13 PM, Tim Peters <tim.peters at gmail.com> wrote:

> [Tim]
> >> That's there because `utcoffset()` is defined to return minutes.
>
> [Bruce Leban]
> > It returns either minutes or a timedelta:
>
> I wrote the code and I wrote the docs.  I know what it does ;-)  Going
> into tedious detail (as the docs do) is simply irrelevant to the point
> here:  utcoffset() returns minutes.  Whether that's _spelled_ as an
> integer or as a timedelta, minutes is minutes is minutes.
>

Just because you wrote the docs doesn't mean you know what they mean to
other readers. The point of documentation is to explain it to someone who
doesn't know what it does after all.

>
>
> Start with the second paragraph of the datetime docs:
>
>     There are two kinds of date and time objects: "naive" and "aware".
>

Thanks.

Before this thread, I had never heard anyone express it as "midnight
> local time" before.  Now that I have heard it, eh - I don't find it a
> helpful way to view it.


Well, it's not surprising that you don't find it's helpful. In fact, it's
wrong, which to me indicates how confusing this. Which of the following are
falsey?

00:00:00+01:00
01:00:00+01:00
01:00:00-01:00
07:00:00+07:00
23:00:00-01:00


I find it particularly surprising that the bug that the OP described
finding would occur in the Russia and China, but not in the US. Obviously,
not an accident. :-)

--- Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140305/098d445e/attachment.html>


More information about the Python-ideas mailing list