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


Groups > comp.lang.python > #80620

Re: [Python-Dev] Dinamically set __call__ method

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:: [': 0.04; 'subject:Python': 0.06; 'consistency': 0.09; 'logic': 0.09; 'subject:method': 0.09; 'subject:set': 0.09; 'that).': 0.09; 'mostly': 0.14; 'fabio': 0.16; 'magic': 0.16; 'subject:Dev': 0.16; 'url:pocoo': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'bit': 0.19; 'trying': 0.19; 'subject:] ': 0.20; 'seems': 0.21; '(the': 0.22; 'simpler': 0.24; 'tend': 0.24; 'post': 0.26; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'related': 0.29; 'is?': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'comments': 0.31; 'invoke': 0.31; 'themselves': 0.32; 'skip:_ 10': 0.34; 'maybe': 0.34; 'could': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'curious': 0.36; 'done': 0.36; 'url:org': 0.36; 'changing': 0.37; 'so,': 0.37; 'performance': 0.37; 'nov': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; '12,': 0.39; 'though,': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'future': 0.60; 'up,': 0.60; 'break': 0.61; 'skip:t 30': 0.61; 'worth': 0.66; 'python- dev': 0.84; 'url:2014': 0.84; 'reasons,': 0.91; 'url:16': 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=euip6a/ojPKUqL2xi7wlDmywx4AjBxYgz8aMssQDalk=; b=oCB+5tArvEZCkHyssdpXX+2UaZicilOzqogHGkmza1l7DPCNtIK2YjSJ/GU0jSTYut p/OsJispBFiVTEn3UaMdIM1A/3Ds6ybi2/QD2kZJ14C1ejM48wTHJmzsX2VuoS3hB8Zx 3mwySY9Mgm33wnzVsWtDFT1uppb5+PGUS2nTRhkXU2nuWtg1tbeQP3TrU76EtgHZ6MfQ ye8hsQrOSNojOUOjBzGT59wPWOzVAUlBAAqjkQ7/UCZxuU0t/2kQNCP2c0RYqINsAJE1 f2o6gWzPRmM2MtqAXsptzX6HqCvoWi9Vfou4lwvi74mX7PzfThrOo4F+81RzAVFWIxdS ZoPA==
X-Received by 10.66.252.193 with SMTP id zu1mr3799959pac.153.1415818774128; Wed, 12 Nov 2014 10:59:34 -0800 (PST)
MIME-Version 1.0
In-Reply-To <CANXBEFqot+KNkhVt210JApbJ7nnENHVszHS-R=J6k222t-3A9w@mail.gmail.com>
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> <CALwzidnE9ZeHV6nM74hKX58LhZ0ova5qB60-eWbw2gLTtk+O3Q@mail.gmail.com> <CANXBEFqot+KNkhVt210JApbJ7nnENHVszHS-R=J6k222t-3A9w@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Wed, 12 Nov 2014 11:58:53 -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.15735.1415818783.18130.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415818783 news.xs4all.nl 2967 [2001:888:2000:d::a6]:39700
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80620

Show key headers only | View raw


On Wed, Nov 12, 2014 at 8:33 AM, Fabio Zadrozny <fabiofz@gmail.com> wrote:
> As a reference, I recently found a blog post related to that:
> http://lucumr.pocoo.org/2014/8/16/the-python-i-would-like-to-see/ (the Slots
> part comments on that).
>
> It does seem a bit counter-intuitive that this happens the way it does
> though, so, can someone from python-dev give some background of why that's
> the way it is? i.e.: instead of the approach which would seem simpler which
> would do getattr(a, '__call__') instead of
> type(a).__dict__['__call__'].__get__(a, type(a)) -- it seems to me it's
> mostly because of historical reasons, but I'm really curious why is it so
> (and if maybe it's something which python-dev would consider worth changing
> in the future -- not sure how much could break because of that though).

I'm not "someone from python-dev", but I think it's done to keep the
look-up logic predictable and avoid having to call __getattribute__
and __getattr__ when looking up magic methods. For at least
__getattribute__ and __getattr__ themselves we *can't* invoke those
methods while trying to look them up, so there's a case to be made for
consistency in that this way we don't have to remember which magic
methods use __getattribute__ and which ones don't. Performance is also
part of it, since these methods tend to be invoked frequently.

Back to comp.lang.python | Previous | Next — Previous 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