Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76839

Re: the output in reference of descriptor.

References <53F69BEE.5000000@gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2014-08-22 22:10 -0600
Subject Re: the output in reference of descriptor.
Newsgroups comp.lang.python
Message-ID <mailman.13324.1408767061.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Thu, Aug 21, 2014 at 7:25 PM, luofeiyu <elearn2014@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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: the output in reference of descriptor. Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-22 22:10 -0600

csiph-web