Created
May 27, 2017 05:54
-
-
Save blubberdiblub/63f8eb18d9e01ff477d66e3507c85869 to your computer and use it in GitHub Desktop.
Explaining list comprehension
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
new_list = [do_something_with(x) for x in old_list] | |
# is basically short for | |
new_list = [] | |
for x in old_list: | |
new_list.append(do_something_with(x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment