Created
January 5, 2017 08:25
-
-
Save encolpe/e8f0f2a545879f5441095064e6dfcbeb to your computer and use it in GitHub Desktop.
What happen if you're append a list to itself in python?
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
#!/bin/python | |
a = [1, 1, 1] | |
b = a | |
print(b) | |
b.append(a) | |
print(b) | |
print(b[-1]) | |
print(b[-1][-1]) | |
c = b | |
while len(c): | |
print(c) | |
c = c[-1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment