Checking the boolean value of a collection
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Fri Sep 12 12:05:33 EDT 2008
Marco Bizzarri:
> >>> any([x for x in [1, 2, 3]])
>
> I mean, I'm afraid I can't use an expression like that without
> building a list... not at least in python2.3
Note that you don't need a list comp there:
>>> any([x for x in [1, 2, 3]])
True
>>> any([1, 2, 3])
True
so this may suffice:
any(self.findActiveOutgoingRegistrationInstancesPlusSomeOtherThings())
Bye,
bearophile
More information about the Python-list
mailing list