Skip to content

Instantly share code, notes, and snippets.

@mastern2k3
Created October 9, 2018 12:19
Show Gist options
  • Save mastern2k3/c77cf18fe30222480a4d68064fac2e04 to your computer and use it in GitHub Desktop.
Save mastern2k3/c77cf18fe30222480a4d68064fac2e04 to your computer and use it in GitHub Desktop.
example for list comprehension and generator behavior
def make_io(res):
def new_io():
print("calculated {}".format(res))
return res
print("created {}".format(res))
return new_io
testers = [make_io(n) for n in range(10)]
is_any = any(n() > 2 for n in testers)
print("is_any", is_any)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment