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

Donald Stufft donald at stufft.io
Wed Mar 5 22:31:36 CET 2014


On Mar 5, 2014, at 4:10 PM, Alex Gaynor <alex.gaynor at gmail.com> wrote:

> Shai Berger <shai at ...> writes:
> 
>> 
>> Hi all,
>> 
>> This is my first post here, following a recommendation from Alexander 
>> Belopolsky to use this list, to try to convince the Python developers to 
>> reopen a ticket. I am a long-time Python user, and a Django committer.
>> 
>> http://bugs.python.org/issue13936 is a complaint about the fact that midnight 
> 
> 
> I strongly support fixing this issue. This behavior is so fundamentally
> nonsensical that resolving it is worth the potential compatibility issues.
> 
> First, I'd like to dispense with the notion that ``if foo`` is somehow a bad
> practice. This is an EXTREMELY common practice as a shorthand for checking for
> None, a great many people consider it more idiomatic, this really isn't a place
> to bikeshed that particlar idiom.
> 
> Now I'd like to address whether this is correct behavior: midnight is not a
> special time. It does not differ from other times in magnitutde (as with a
> container), it is not equivilant to the False value (as with 0). It is simply,
> sometimes, represented as 00:00:00 (or 12:00:00!). The fact that it's
> representation is composed of zeros no more makes it false than the point in
> 3-space at (0, 0, 0) is false. It's still a completely normal time, which in
> no way distinguishes itself from any other.
> 
> I don't have a strong perspective on what the exact deprecation or breakage
> cycle should like, but it's very clear to me that this behavior is nonsensical.
> Out of a sample of half-a-dozen python programmers I've told about this, the
> *universal* response was confusion and revulsion. I strongly suspect that the
> majority of people writing ``if time_object`` have a bug in their code.
> 
> Alex
> 
> _______________________________________________
> 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/

I completely agree with Alex here. This is a ridiculous behavior and it should be fixed.

I find the argument that it would only be fixed in 3.something and thus not be really
fixed for X years disingenuous at best. That fact is true for *ALL* bug fixes in Python
so by that logic we should simply give up on fixing anything in Python ever?

-----------------
Donald Stufft
PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140305/1a0e9fc6/attachment.sig>


More information about the Python-ideas mailing list