Created
October 9, 2018 12:19
-
-
Save mastern2k3/c77cf18fe30222480a4d68064fac2e04 to your computer and use it in GitHub Desktop.
example for list comprehension and generator behavior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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