On 7/11/2010 12:51 PM, pyt...@bdurham.com wrote:
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.
Python was not really not developed for multi-developer projects whose members are willing to stomp on each others objects.
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?
-- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list