the output in reference of descriptor.

Ian Kelly ian.g.kelly at gmail.com
Sat Aug 23 00:10:13 EDT 2014


On Thu, Aug 21, 2014 at 7:25 PM, luofeiyu <elearn2014 at gmail.com> wrote:
> >>> c2.d.a
> __get__() is called <__main__.C2 object at 0x000000000297BE10> <class
'__main__.
> C2'>
> __getattribute__() is called
> 'abc'
>
> Why the result of c2.d.a  is not :
>
> __get__() is called <__main__.C2 object at 0x000000000297BE10> <class
'__main__.
> C2'>
> __getattribute__() is called
> 'abc'

As far as I can tell you pasted the same output twice, so I don't
understand what it is that you're asking.

> Why the` return self` in the __get__ method in class C  does not work?

It does work. When you type "c2.d" above, the result was the C instance,
i.e. self.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140822/8f7110ec/attachment.html>


More information about the Python-list mailing list