Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import copy
- class MyClass:
- def __init__(self, name):
- self.name = name
- def __cmp__(self, other):
- return cmp(self.name, other.name)
- a = MyClass('a')
- my_list = [a]
- dup = copy.deepcopy(my_list)
- print ' my_list:', my_list
- print ' dup:', dup
- print ' dup is my_list:', (dup is my_list)
- print ' dup == my_list:', (dup == my_list)
- print ' dup[0] is my_list[0]:', (dup[0] is my_list[0])
- print ' dup[0] == my_list[0]:', (dup[0] == my_list[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement