[Python-ideas] bool(datetime.time(0, 0))
Paul Moore
p.f.moore at gmail.com
Tue May 8 13:12:05 CEST 2012
On 8 May 2012 11:53, Antoine Pitrou <solipsis at pitrou.net> wrote:
>> If you want to test for None return values, you need to use
>> "if is None" or "if is not None".
>
> So who writes the PEP to deprecate __bool__ methods wholesale?
I see no need - if you're testing for "true" return values, bool is
correct. But if you're testing for None vs an actual value, it's not.
The fact that testing for boolean true values is a lot rarer than
people think, or that it's not appropriate in certain situations,
doesn't mean it's useless.
Paul.
More information about the Python-ideas
mailing list