Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> class sample:
- ... def __init__(self, arr=[]):
- ... self.arr = arr
- ...
- >>> s1 = sample()
- >>> s2 = sample()
- >>> s1.arr
- []
- >>> s2.arr
- []
- >>> s2.arr.append(2)
- >>> s2.arr
- [2]
- >>> s1.arr
- [2]
- >>> s3 = sample([3])
- >>> s3.arr
- [3]
- >>> s2.arr
- [2]
- >>> s1.arr
- [2]
- >>> id(s1.arr) == id(s2.arr)
- True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement