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

Nick Coghlan ncoghlan at gmail.com
Wed Mar 5 23:43:59 CET 2014


On 6 Mar 2014 08:11, "Donald Stufft" <donald at stufft.io> wrote:
>
> Most of those are pretty easy to reason about being "False", they all
have some
> concept of empty, nothing, etc. Midnight however is not any more or less
a time
> than one minute past midnight. Even worse, if you consider not explicitly
> checking for None a bug in that application code, debugging that code is
made
> much more difficult because of the fact that for some reason "midnight" is
> considered False.
>
> That is the real problem here, sure people should be using ``is None``
checks
> but until people are perfect and never write buggy code, we have to
contend
> with the fact that sometimes people will not write ``is None``. Making
that
> particular error harder to debug is doing nothing but wasting their time
and
> having Python be punitive for what in many cases may be a mistake.

Right, the core problem here is changing an often harmless style problem
into a subtle behavioural bug. I changed the title on
http://bugs.python.org/issue13936 accordingly, reopened it and described
the appropriate next steps for anyone that is motivated enough about the
issue to actually do the work.

We'll see if the enthusiasm for changing the behaviour translates into
anyone being sufficiently interested to work out the details of the
deprecation warning and the associated documentation and test updates.

Regards,
Nick.

>
> -----------------
> Donald Stufft
> PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372
DCFA
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140306/47b44c79/attachment.html>


More information about the Python-ideas mailing list