Advertisement
here2share

# var_copy.py

May 8th, 2015
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. # var_copy.py
  2.  
  3. import copy
  4.  
  5. class number():
  6.     def __init__(self, name, number):
  7.         self.name = name
  8.         self.number = number
  9.  
  10. c = number(1, "one")
  11. d = c
  12. e = copy.copy(c)
  13.  
  14. print(c.number, d.number, e.number)
  15. d.number = 2
  16. e.number = 5
  17. print(c.number, d.number, e.number)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement