Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Shai Berger <shai-9mtU2oJkgntWk0Htik3J/w <at> public.gmane.org>
Subject: Please reconsider the Boolean evaluation of midnight
Newsgroups: gmane.comp.python.ideas
Date: Wednesday 5th March 2014 10:16:12 UTC (over 3 years ago)
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 
-- datetime.time(0,0,0) -- is evaluated as False in Boolean contexts. It
was 
closed as invalid, under the claim that """It is odd, but really no odder
than 
"zero values" of other types evaluating to false in Boolean contexts""".

I would like to ask for this to be reconsidered; since the ticket was
closed, 
two main arguments were given for this:

1) The practical argument (paraphrasing Danilo Bergen and Andreas Pelme):
The 
current semantics is surprising and useless; users do not expect valid
times 
to be falsey, and do not normally want code to have special behavior on 
midnight. Users who ask for Boolean evaluation of a variable that's
supposed 
to hold a time value, usually write "if var" as shorthand for "if var is
not 
None".

2) The principled argument (which I think is at the root of the practical 
argument); quoting myself from the ticket: """Midnight is not a "zero
value", 
it is just a value. It does not have any special qualities analogous to
those 
of 0, "", or the empty set. ... Midnight evaluting to false makes as much 
sense as date(1,1,1) -- the minimal valid date value -- evaluating to 
false""".

Thanks,
	Shai.
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
 
CD: 4ms