>>> old = [1, 2, 3] >>> new = old[:] >>> old is new False
>>> old = (1, 2, 3) >>> new = old[:] >>> old is new True
Tuple is immutable. Therefore, it skips the copy because it doesnt matter if it's a new object or not.
Post a Comment
1 comment:
Tuple is immutable. Therefore, it skips the copy because it doesnt matter if it's a new object or not.
Post a Comment