How can I make an existing object read-only?
Irmen de Jong
irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Tue Oct 5 12:43:59 EDT 2004
Duncan Booth wrote:
> An alternative is just to pass a copy of the object. That way the recipient
> can do what they like with it, but the calling code won't see any changes.
Agreed, but then any attempts to change the attributes will go
unnoticed. I wanted a solution that would catch these attempts
and trow an exception (perhaps this wasn't clear enough in
my original question).
Thanks anyway.
--Irmen
More information about the Python-list
mailing list