Created
October 17, 2019 20:41
-
-
Save casperlehmann/ae398d915467e76e8e45e65aa6e6c229 to your computer and use it in GitHub Desktop.
Revisions
-
casperlehmann created this gist
Oct 17, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ # 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] """