Michal Kwiatkowski wrote:
> Alex Martelli napisaƂ(a):
>>>>> obj.__dict__
>> {}
>>
>> ...the presence of '__dict__' as an entry in C is confusing the issue,
>> because that's what you get in this case as obj.__dict__.
> 
> It still bugs me. What's the actual procedure when doing attribute
> assignment? I understand it like this:
> 
> obj.attr = value
>  * if instance class has __setattr__, call it
>    * else: if class has an attribute with name "attr" check if it's a
>      descriptor; when it's overriding descriptor, call its __set__
>      method, otherwise raise AttributeError
>      * else: bind "attr" as object attribute
> 

Here is a step-by-step description of what happens when you set or get 
an attribute on an object:

http://cafepy.com/article/python_attributes_and_methods/ch01s05.html

Cheers,
Shalabh

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to