You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
nirna
changed the title
Why
Why [ [None] * 3] * 3 is not the same as [[None, None, None], [None, None, None], [None, None, None]]?
Jul 29, 2016
nirna
changed the title
Why [ [None] * 3] * 3 is not the same as [[None, None, None], [None, None, None], [None, None, None]]?
Why [ [x] * 3] * 3 is not the same as [[x, x, x], [x, x, x], [x, x, x]] ?
Jul 30, 2016
Turns out Python's * n operator creates a new reference to the same structure, instead of creating a new list. Thus every change to the original list reflects in all 3 lists which breaks the game.
My python shows both as equal:
Why do you say they're not the same?
The text was updated successfully, but these errors were encountered: