Skip to content

Instantly share code, notes, and snippets.

@acwoss
Created June 1, 2018 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acwoss/e46b41bf8fafcf906a3e37ff19e05cb1 to your computer and use it in GitHub Desktop.
Save acwoss/e46b41bf8fafcf906a3e37ff19e05cb1 to your computer and use it in GitHub Desktop.
LimeFrozenTwintext created by acwoss - https://repl.it/@acwoss/LimeFrozenTwintext
x = [1, 2, 3, 4, 5]
y = [2, 4]
def remove_duplicados(l1, l2):
return (i for i in l1 if i not in l2)
z = remove_duplicados(x, y)
# Alteração em y:
y.append(3)
print(type(z)) # <class 'generator'>
# Saída de z modificada devido alteração em y:
print(list(z)) # [1, 5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment