In article <51792710$0$29977$c3e8da3$54964...@news.astraweb.com>,
 Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote:

> > It also says, "Its truth value is true".  Why would they document that
> > fact if you weren't supposed to use it as a boolean operand?
> 
> You can use *anything* in Python in a boolean context. That's a language 
> feature: all objects are either truthy or falsey. As for why it is 
> documented for NotImplemented, I guess that's because some people might 
> guess that it is falsey, like None.

That was part of what added the epiphanality to the experience.  My 
first guess was exactly as you say, that bool(NotImplemented) would be 
false.  Once I discovered that it was true, the rest immediately fell 
into place and many lines of code got replaced by the simple:

    return all(r(...) for r in rules)
                  ^
                  |
                  +---- stuff that I'm not showing goes here :-)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to