[Python-ideas] bool(datetime.time(0, 0))

Georg Brandl g.brandl at gmx.net
Tue May 8 12:25:48 CEST 2012


On 05/08/2012 11:56 AM, Antoine Pitrou wrote:
> On Tue, 8 May 2012 17:02:04 +1000
> Nick Coghlan <ncoghlan at gmail.com> wrote:
>> 
>> IMO, you've completely misdiagnosed the source of that bug. Never
>> *ever* rely on boolean evaluation when testing against None.
> 
> Nick, that's just plain silly. If we didn't want people to rely on
> boolean evaluation, we wouldn't define __bool__ at all (or we would
> make it return a random value).

Read again: he's talking about people using "bool(x)" (implicitly) when
they mean "x is not None".

Georg




More information about the Python-ideas mailing list