Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.062 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; '*args,': 0.09; 'def': 0.12; '**kwargs)': 0.16; '**kwargs):': 0.16; 'name):': 0.16; '>>>': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'instance,': 0.24; 'skip:_ 20': 0.27; 'class': 0.32; 'skip:_ 10': 0.34; 'subject:the': 0.34; 'received:google.com': 0.35; 'method': 0.36; 'received:10': 0.37; 'skip:o 20': 0.38; 'message- id:@gmail.com': 0.38; 'work?': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'called': 0.40; 'name': 0.63; 'x):': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=tTWdzbgW0xZIdxP7PZDHZZdT29S+F6P8vMzV503BxJM=; b=toAcna1AcNEwDg1n+jK829jTKecfN9gRVLv8hTXk8FcaVhPZzbFdCdT2jPzn/kQrHm TOdZGlTyNZtXP6v+TaQKZJbuZ9FilVek0ASQuBy4K/yFRFS3wowCzT7farv1unMOzQII rnwBWZimFiQNhS3D6msnLKuAjzaQ506nWDqmCK2OQSqlb11QpCYbuZ1/AKcRHVBILHfT 6vvSSpeWYTRzcsv0EOHS6OtLppFNOBa99C2pr8mS+70A5SDLmdI/W4aFMiJAdevzbc2K ywS/JJNKhX2QMfCWSrvHcqkm9JdAy1dSQXBvz3Q5/5W655I97aTMKuAo+Q+Z5Etk74OV VEqQ== X-Received: by 10.70.96.233 with SMTP id dv9mr2462733pdb.146.1408670726582; Thu, 21 Aug 2014 18:25:26 -0700 (PDT) Date: Fri, 22 Aug 2014 09:25:02 +0800 From: luofeiyu User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: python-list@python.org Subject: the output in reference of descriptor. Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 51 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1408670735 news.xs4all.nl 2923 [2001:888:2000:d::a6]:33539 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76761 class C(object): a = 'abc' def __getattribute__(self, *args, **kwargs): print("__getattribute__() is called") return object.__getattribute__(self, *args, **kwargs) def __getattr__(self, name): print("__getattr__() is called ") return name + " from getattr" def __get__(self, instance, owner): print("__get__() is called", instance, owner) return self def foo(self, x): print(x) class C2(object): d = C() >>> c2.d __get__() is called <__main__.C2 object at 0x000000000297BE10> <__main__.C object at 0x000000000297BBA8> I understant the result ,c2.d trigger the __get__ method in class C. def __get__(self, instance, owner): print("__get__() is called", instance, owner) return self It print "__get__() is called", instance, owner and return self `<__main__.C object at 0x000000000297BBA8>` >>> c2.d.a __get__() is called <__main__.C2 object at 0x000000000297BE10> __getattribute__() is called 'abc' Why the result of c2.d.a is not : __get__() is called <__main__.C2 object at 0x000000000297BE10> __getattribute__() is called 'abc' Why the` return self` in the __get__ method in class C does not work?