Hi All: I am just a beginner in python. Can anyone please tell me what is wrong with this piece of code?
import copy class BaseDummyObject(object): def __init__(self): pass def __getattr__(self, item): try: return self.__dict__.__getitem__(item) except KeyError: print "Attribute Error: attr %s of class %s non-existent!" %(item, self.__class__.__name__) class DummyObject(BaseDummyObject): pass def main(): bar = 3 obj = DummyObject() obj.foo = bar obj.me = obj newobj = copy.deepcopy(obj) if __name__ == "__main__": main() So when I do this, I get: Attribute Error: attr __deepcopy__ of class DummyObject non-existent! Attribute Error: attr __getnewargs__ of class DummyObject non- existent! Traceback (most recent call last): File "C:\Workspace\QA3.0\Python_Lib\Mobidia\RemoteManager \test_code.py", line 39, in <module> main() File "C:\Workspace\QA3.0\Python_Lib\Mobidia\RemoteManager \test_code.py", line 30, in main newobj = copy.deepcopy(obj) File "C:\Python26\lib\copy.py", line 181, in deepcopy rv = reductor(2) TypeError: 'NoneType' object is not callable Any help will be really appreciated. -- http://mail.python.org/mailman/listinfo/python-list