Checking the boolean value of a collection
Diez B. Roggisch
deets at nospam.web.de
Fri Sep 12 10:09:02 EDT 2008
Marco Bizzarri schrieb:
> Hi all.
>
> In many parts of my code I've the following schema of code:
>
> def isInUseByOutgoingRegistrations(self, archivefolder):
> for instance in self.findActiveOutgoingRegistrationInstances():
> if instance.forbidToClose(archivefolder):
> return True
> return False
>
> Before devising my own solution for this kind of problem, I wonder if
> there is a common solution for the problem. I'm looking for a
> python2.3 solution.
if any(instance.forbitToClose(archivefolder) for instance in
self.findActiveOutgoingRegistrationInstances())
You should also consider using PEP8 style naming.
Diez
More information about the Python-list
mailing list