Bengt Richter a écrit :
On Tue, 15 Mar 2005 20:21:19 +0100, bruno modulix <[EMAIL PROTECTED]> wrote:


Hi

How can I make a *class* attribute read-only ?

(snip)

Does this help, or did I misunderstand?

 >>> class Base(object):
 ...     class __metaclass__(type):
 ...         def __setattr__(cls, name, value):
 ...             raise AttributeError, 'setting %r to %r not allowed' %(name, 
value)

Pretty obvious, indeed !

Bengt, if we meet one day, remind me to pay you a couple of your favorite drink !-)
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to