Skip to content

Instantly share code, notes, and snippets.

@icio

icio/gist:3166670

Created Jul 23, 2012
Embed
What would you like to do?
Python for/else
# For and if
for module in self.modules.values():
ok = True
for f in filters:
if not f(module):
ok = False
break
if ok:
yield module
# For..else
for module in self.modules.values():
for f in filters:
if not f(module):
break
else:
yield module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment