Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.04; 'subject:Python': 0.06; 'attribute': 0.07; 'class,': 0.07; 'responding': 0.07; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'subject:method': 0.09; 'subject:set': 0.09; '~ethan~': 0.09; 'python': 0.11; 'callable.': 0.16; 'descriptor': 0.16; 'evaluating': 0.16; 'invoking': 0.16; 'normally,': 0.16; 'said.': 0.16; 'subject:Dev': 0.16; 'comment:': 0.16; 'wrote:': 0.18; 'subject:] ': 0.20; 'seems': 0.21; '(in': 0.22; 'header:User-Agent:1': 0.23; 'instance,': 0.24; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'returned': 0.30; "i'm": 0.30; 'though.': 0.31; 'class': 0.32; "we're": 0.32; 'skip:_ 10': 0.34; 'maybe': 0.34; 'there': 0.35; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'received:173': 0.61; 'more': 0.64; 'talking': 0.65; 'behavior': 0.77; '"look': 0.84; 'ethan': 0.84; 'examining': 0.84; 'furman': 0.84; 'technique': 0.93 Date: Sun, 09 Nov 2014 12:16:17 -0800 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: [Python-Dev] Dinamically set __call__ method References: <545919B6.7040007@stoneleaf.us> <87a943qyvn.fsf@handshake.de> <545CC204.2010301@stoneleaf.us> <8761eq424e.fsf@handshake.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415564188 news.xs4all.nl 2895 [2001:888:2000:d::a6]:59821 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80438 On 11/09/2014 03:38 AM, Gregory Ewing wrote: > Ethan Furman wrote: >> >> And the thing going on is the normal python behavior (in __getattribute__, I believe) of examining the returned >> attribute to see if it is a descriptor, and if so invoking it. > > Only if you look it up through the instance, though. > Normally, if you look up an attribute on a class, > the descriptor protocol doesn't get triggered. Hrmm, maybe we're not talking about the same thing. I was responding to your comment: > (BTW, I'm actually surprised that this technique makes c callable. > There must be more going on that just "look up __call__ in the class > object", because evaluating C.__call__ just returns the descriptor > and doesn't invoking the descriptor mechanism.) which seems to clash with what you just said. -- ~Ethan~