[Python-ideas] Please reconsider the Boolean evaluation of midnight
Mark Lawrence
breamoreboy at yahoo.co.uk
Wed Mar 5 23:47:45 CET 2014
On 05/03/2014 22:38, Alexander Belopolsky wrote:
>
> On Wed, Mar 5, 2014 at 5:16 PM, Ben Finney <ben+python at benfinney.id.au
> <mailto:ben+python at benfinney.id.au>> wrote:
>
> .. midnight is not special in
> the way “empty” or “zero magnitude” are. Midnight is an arbitrary point
> on a continuum, ..
>
>
> Tell that to people who gather in the Times Square on New Year Eve!
>
> It is very common to implement time-of-day in the languages that lack a
> dedicated class as seconds since midnight or fraction of a 24 hour day
> or any similar scheme. In all these schemes midnight is false in
> boolean context.
>
> Note that when datetime module was introduced, Python did not have a
> time class and people were using int or float to denote time-of-day.
> Compatibility with older schemes could be part of the original
> motivation. It also made more sense when the dunder method was spelled
> __nonzero__.
>
> Whatever the reason was - this is a well established feature and it
> won't change.
>
Have you looked at the issue recently? :)
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
More information about the Python-ideas
mailing list