Dear All,
Can a python class contain an instance of itself as a data container may look like this?
class A:
def __init__(self, val):
self.a = A(val)
self.val = val
aa = A(2)
#this will cause RuntimeError: maximum recursion depth exceeded
my purpose is using this class as a data container contain a copy inside if it when it be inited to reduce the deepcopy action. it may used as an "undo" chain give a chance to get the init val's value when it's necessary.
is it possible for such an action?
Thanks
KC