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

Antoine Pitrou solipsis at pitrou.net
Thu Mar 6 11:19:46 CET 2014


Le 05/03/2014 22:10, Alex Gaynor a écrit :
> 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.

Agreed. If we didn't want people to rely on that idiom then __bool__ 
would have to raise TypeError on most types except a select ones.

Regards

Antoine.




More information about the Python-ideas mailing list