Skip to content

Instantly share code, notes, and snippets.

@molly
Last active August 29, 2015 14:21
Show Gist options
  • Save molly/18d5efba978afb04f838 to your computer and use it in GitHub Desktop.
Save molly/18d5efba978afb04f838 to your computer and use it in GitHub Desktop.
list comprehension
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