On Sun, Jul 11, 2010 at 9:51 AM, <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?
Have you considered just making a deep copy of your object instead? That way, others could inspect the copy and mess with it all they want, without affecting the original. http://docs.python.org/library/copy.html#copy.deepcopy Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list