Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> class obj:
- ... def __init__(self):
- ... self.counter = 0
- ... def inc(self):
- ... self.counter += 1
- ...
- >>> a = obj()
- >>> from copy import copy
- >>> b = copy(a)
- >>> a.inc()
- >>> b.inc()
- >>> b.inc()
- >>> b.inc()
- >>> print a.counter, b.counter
- 1 3
Add Comment
Please, Sign In to add comment