fork download
  1. import collections
  2. import copy
  3.  
  4. Foo = collections.namedtuple('Foo', ['x'])
  5.  
  6. x = Foo([])
  7. x.x.append(x)
  8.  
  9. y = copy.deepcopy(x)
  10. print(id(y), id(y.x[0]), y is y.x[0])
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
47891400377544 47891400377480 False