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


Groups > comp.lang.python > #80505

Re: [Python-Dev] Dinamically set __call__ method

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:: [': 0.04; 'subject:Python': 0.06; 'lookup': 0.09; 'subject:method': 0.09; 'subject:set': 0.09; 'bind': 0.16; 'callable.': 0.16; 'descriptor': 0.16; 'evaluating': 0.16; 'invoking': 0.16; 'subject:Dev': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'subject:] ': 0.20; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'class': 0.32; 'actual': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'method': 0.36; 'nov': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'skip:t 30': 0.61; 'course': 0.61; 'more': 0.64; '"look': 0.84; 'technique': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=uyBV1cZQeyB+9/M7BO+4WKDe3p3OUrr1Y9C/GhtgPnk=; b=SSx3GsnAO9xynU6xyDmRs3BYkr5VMvVW7340qRRnKfDazhn1nVxSSCF1SXgxjWzyM+ tLg7IvGrj/481xO57Jw2mP2xMtsy9bL91t/jG2naQBQzyiPGahr1ulThcorEAcGPvSob 2/wSL7kGOEu0lPQkhewifGjWoQ8UcRLh0zOYlYtpdLij0XneBzOLo3AzHST+kKX9jfta M0hdwKf9dpV1Y4L1wTf8t3ecbF37ss+jMe7khpo8N4oyAVFoYk/ffy9Sc7TzuJCI65mh LHN17UxAtQv4nKeSzYinQt6QXzh1U06I7IqChxdtU3ryo3/YN4z91lhuxvvmx4ZjYZN8 Rn2A==
X-Received by 10.68.65.37 with SMTP id u5mr38889976pbs.24.1415691860943; Mon, 10 Nov 2014 23:44:20 -0800 (PST)
MIME-Version 1.0
In-Reply-To <cc7jtiFubltU1@mid.individual.net>
References <CAF0TK51TKs+tw=u_rzrWVeSsDK7cOBt1Gcvq_izLfMObuDYNig@mail.gmail.com> <545919B6.7040007@stoneleaf.us> <CAF0TK52vw_SmqexN8RXyGs8GSKecPobK54ZqYPyKgRSSJy9zWw@mail.gmail.com> <mailman.15467.1415128339.18130.python-list@python.org> <c25aa612-bff2-4982-8fb9-5b17a866bead@googlegroups.com> <87a943qyvn.fsf@handshake.de> <545CC204.2010301@stoneleaf.us> <8761eq424e.fsf@handshake.de> <mailman.15584.1415476169.18130.python-list@python.org> <cc7jtiFubltU1@mid.individual.net>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 11 Nov 2014 00:43:40 -0700
Subject Re: [Python-Dev] Dinamically set __call__ method
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15648.1415691870.18130.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415691870 news.xs4all.nl 2960 [2001:888:2000:d::a6]:42668
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80505

Show key headers only | View raw


On Sat, Nov 8, 2014 at 3:31 PM, Gregory Ewing
<greg.ewing@canterbury.ac.nz> wrote:
> (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.)

But of course it doesn't just lookup C.__call__, because it has to
bind the method to the instance before calling it, which means
invoking the descriptor protocol. The actual lookup is more like:

type(a).__dict__['__call__'].__get__(a, type(a))

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


Thread

Re: [Python-Dev] Dinamically set __call__ method Ethan Furman <ethan@stoneleaf.us> - 2014-11-04 11:12 -0800
  Re: [Python-Dev] Dinamically set __call__ method John Ladasky <john_ladasky@sbcglobal.net> - 2014-11-06 12:21 -0800
    Re: [Python-Dev] Dinamically set __call__ method dieter <dieter@handshake.de> - 2014-11-07 07:59 +0100
    Re: [Python-Dev] Dinamically set __call__ method Ethan Furman <ethan@stoneleaf.us> - 2014-11-07 04:58 -0800
    Re: [Python-Dev] Dinamically set __call__ method dieter <dieter@handshake.de> - 2014-11-08 07:50 +0100
    Re: [Python-Dev] Dinamically set __call__ method Ethan Furman <ethan@stoneleaf.us> - 2014-11-08 11:49 -0800
      Re: [Python-Dev] Dinamically set __call__ method Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-11-09 11:31 +1300
        Re: [Python-Dev] Dinamically set __call__ method Ethan Furman <ethan@stoneleaf.us> - 2014-11-08 19:27 -0800
          Re: [Python-Dev] Dinamically set __call__ method Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-11-10 00:38 +1300
            Re: [Python-Dev] Dinamically set __call__ method Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-10 00:14 +1100
            Re: [Python-Dev] Dinamically set __call__ method Ethan Furman <ethan@stoneleaf.us> - 2014-11-09 12:16 -0800
        Re: [Python-Dev] Dinamically set __call__ method Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-11 00:43 -0700
        Re: [Python-Dev] Dinamically set __call__ method Fabio Zadrozny <fabiofz@gmail.com> - 2014-11-12 13:33 -0200
          Re: [Python-Dev] Dinamically set __call__ method Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-11-13 17:20 +1300
            Re: [Python-Dev] Dinamically set __call__ method Fabio Zadrozny <fabiofz@gmail.com> - 2014-11-13 11:38 -0200
        Re: [Python-Dev] Dinamically set __call__ method Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-12 11:58 -0700

csiph-web