checking if two things do not equal None

Chris Angelico rosuav at gmail.com
Sun Mar 30 00:17:49 CET 2014


On Sun, Mar 30, 2014 at 9:46 AM, Tim Chase <tim at thechases.com> wrote:
> Though am I correct that your iteration tests for equality, while
> mine tests for identity?  Also, my version bails early in the event
> quitting early is possible.  That's particularly useful in the case
> of doing something like
>
>   if all(x() is None for x in [func1, func2, func3, costly_func]):
>     do_something()

Presumably you mean to actually call those functions, as checking the
identity of a costly function is still cheap :)

ChrisA



More information about the Python-list mailing list