I have a complex object with attributes that contain lists, sets, dictionaries, and other objects. The lists and dictionaries may themselves contain complex objects.
I would like to provide a read-only version of this type of object for other developers to query for reporting. Is there a way to prevent other developers from changing the attributes of my complex and nested object? In researching this question, I have identified __setattr__ and __delattr__ as possible ways to prevent changes to simple attributes, but I don't believe these magic methods will prevent others from fiddling with attributes containing lists and dictionaries or the contents of these lists and dictionaries. Another idea I had was to create a wrapper object to proxy all access to the original object. Is there a generic reciepe for this type of wrapper? Thank you, Malcolm
-- http://mail.python.org/mailman/listinfo/python-list