Lazy Attribute

Rouslan Korneychuk rouslank at
Fri Nov 16 11:12:11 CET 2012

On 11/16/2012 04:32 AM, Rouslan Korneychuk wrote:
> On 11/16/2012 02:49 AM, Andriy Kornatskyy wrote:
>>> If accessing the descriptor on the class object has no special
>>> meaning, then the custom is to return the descriptor object itself, as
>>> properties do.
>> If I would satisfy this, I will be forced to check for None 99.9% of
>> the use cases (it is not None, being applied to an object). Thus it
>> behaves as designed.
> That's not true. You can use a try-except block to return the descriptor
> object when an AttributeError is raised.

Actually, never mind. I just realized the function has to be called 
before the attribute can be set, which can not-only raise any exception, 
but could potentially have undesired side-effects given a parameter it 
doesn't expect.

More information about the Python-list mailing list