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

Antoine Pitrou solipsis at pitrou.net
Tue May 8 14:00:44 CEST 2012


On Tue, 08 May 2012 13:45:57 +0200
Georg Brandl <g.brandl at gmx.net> wrote:
> On 05/08/2012 01:17 PM, Antoine Pitrou wrote:
> > On Tue, 8 May 2012 12:12:05 +0100
> > Paul Moore <p.f.moore at gmail.com> wrote:
> >> 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.
> > 
> > Well, again, if that's the case, then __bool__ should be deprecated for
> > all types where being "true" or "false" doesn't make obvious sense.
> > Which is most types, actually.
> 
> Repeating a strange argument does not make it more true.

Well, it does follow from what you wrote above...

Regards

Antoine.





More information about the Python-ideas mailing list