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

Antoine Pitrou solipsis at pitrou.net
Tue May 8 12:51:48 CEST 2012


On Tue, 08 May 2012 12:25:48 +0200
Georg Brandl <g.brandl at gmx.net> wrote:
> 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".

That's what I read.






More information about the Python-ideas mailing list