Last active
August 29, 2015 14:21
-
-
Save molly/18d5efba978afb04f838 to your computer and use it in GitHub Desktop.
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
holding = [x for x in holding if x != item] | |
equivalent to | |
new_holding = [] | |
for x in holding: | |
if x != item: | |
new_holding.append(item)' | |
holding = new_holding |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment