What is the easiest, most concise way to make selected attributes in an instance be readonly?

Posted by Kevin Little on Stack Overflow See other posts from Stack Overflow or by Kevin Little
Published on 2008-09-24T02:15:21Z Indexed on 2010/04/24 11:43 UTC
Read the original article Hit count: 160

Filed under:
|
|

In Python, I want to make selected instance attributes of a class be readonly to code outside of the class. I want there to be no way outside code can alter the attribute, except indirectly by invoking methods on the instance. I want the syntax to be concise. What is the best way? (I give my current best answer below...)

© Stack Overflow or respective owner

Related posts about python

Related posts about attributes