Re: block dynamic attribute creation (was: get descriptor from instance)

2009-02-19 Thread Gabriel Genellina
En Thu, 19 Feb 2009 01:29:17 -0200, Alan G Isaac escribió: OK, that's good. I'd like to sometimes lock attribute creation on instances of a class but still allow properties to function correctly. Will something like below be satisfactory? def __setattr__(self, attr, val): """If insta

Re: block dynamic attribute creation (was: get descriptor from instance)

2009-02-18 Thread Alan G Isaac
On 2/18/2009 6:15 PM Gabriel Genellina apparently wrote: type(a).x OK, that's good. I'd like to sometimes lock attribute creation on instances of a class but still allow properties to function correctly. Will something like below be satisfactory? Thanks, Alan def __setattr__(self, attr, v

Re: get descriptor from instance

2009-02-18 Thread Gabriel Genellina
En Wed, 18 Feb 2009 20:48:17 -0200, Alan G Isaac escribió: What is a reliable way to get the the property object for an instance attribute? (Or more generally, to get the descriptor controlling an attribute?) If class ``A`` defines the property ``x`` and ``a`` in an instance of ``A``, then y

get descriptor from instance

2009-02-18 Thread Alan G Isaac
What is a reliable way to get the the property object for an instance attribute? (Or more generally, to get the descriptor controlling an attribute?) If class ``A`` defines the property ``x`` and ``a`` in an instance of ``A``, then you can just use ``type(a).__dict__['x']`` to get the property ob