Created
October 17, 2019 20:41
-
-
Save casperlehmann/ae398d915467e76e8e45e65aa6e6c229 to your computer and use it in GitHub Desktop.
I feel like this shouldn't be allowed
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
# weirdness.py | |
def loop_for(i, li=[]): | |
while len(li) <= i: | |
print(li) | |
li[len(li):len(li)+1] = [len(li)] | |
loop_for(9) | |
loop_for(9, ['x', 'y', 'z']) | |
""" | |
[] | |
[0] | |
[0, 1] | |
[0, 1, 2] | |
[0, 1, 2, 3] | |
[0, 1, 2, 3, 4] | |
[0, 1, 2, 3, 4, 5] | |
[0, 1, 2, 3, 4, 5, 6] | |
[0, 1, 2, 3, 4, 5, 6, 7] | |
[0, 1, 2, 3, 4, 5, 6, 7, 8] | |
['x', 'y', 'z'] | |
['x', 'y', 'z', 3] | |
['x', 'y', 'z', 3, 4] | |
['x', 'y', 'z', 3, 4, 5] | |
['x', 'y', 'z', 3, 4, 5, 6] | |
['x', 'y', 'z', 3, 4, 5, 6, 7] | |
['x', 'y', 'z', 3, 4, 5, 6, 7, 8] | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment