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


Groups > comp.lang.python > #72982

Re: Uniform Function Call Syntax (UFCS)

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.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.045
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'stack,': 0.09; 'stack.': 0.09; 'subject:Function': 0.09; 'python': 0.11; 'globals': 0.16; 'globals(),': 0.16; 'globals.': 0.16; 'indirectly': 0.16; 'all.': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'example': 0.22; 'affects': 0.24; 'module,': 0.24; 'mon,': 0.24; 'push': 0.26; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'resolution': 0.29; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'though.': 0.31; 'figure': 0.32; 'quite': 0.32; 'could': 0.34; 'subject: (': 0.35; "can't": 0.35; 'except': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'done': 0.36; 'to:addr:python- list': 0.38; 'that,': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'called': 0.40; 'even': 0.60; 'ian': 0.60; 'matter': 0.61; 'simply': 0.61; 'name': 0.63; 'become': 0.64; 'more': 0.64; 'different': 0.65; 'fact,': 0.69; 'difference.': 0.84
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=vXrVvuHjNpDN6kWAWFOCvbE2wzchW9Ff5l50R+aOaXo=; b=n6NHSNJbZoIPME6713v4PKZFqXotTMud2TymQOSMXROx23bhtQkr1vXPeuFuVCB4Kn 6mgzf9afa+aZQ9Fz+GtrFk5ZxcckMVFWqCarnjC8ieKhHwTXpcz7o1xtGY0LyGJg2jUY axiwnrT5edR1rbbwGjxNtqkkXIkm+EBRV/3OWCv74Z9KoQpnD4BhkgzKlXg8dur9GwBc 2S9lqDkDSiIlm5xnCffol1Zh2iNR49BdODsG3jL2jJFB1MQRMIqTwvrubsyVCe1m4/LL IAYAs9t+1tbGMig6RLXmzOEJJ3NndzEj8s7OknvA9Tr7neFUbbUlP8AH12mzndEGnB1n sYHQ==
X-Received by 10.236.227.230 with SMTP id d96mr3195748yhq.100.1402248308634; Sun, 08 Jun 2014 10:25:08 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CAPTjJmrD28nS=tj_bm_SkwuqLNSY4F_RAKpKAWTYNh9x6RtBCQ@mail.gmail.com>
References <8b96ae27-20fa-4df9-807e-c806fed983c0@googlegroups.com> <mailman.10859.1402169265.18130.python-list@python.org> <bvhsgeF2on9U2@mid.individual.net> <1dd863ba-09e5-439b-8669-db65f3e999eb@googlegroups.com> <roy-68FCA5.10591408062014@news.panix.com> <927afb61-be0e-43a1-8aab-107e77a013fc@googlegroups.com> <CAPTjJmpGwu5xiH3kAYHO5Lk8Ycib44an-wkAVwSLPF67uWC=sg@mail.gmail.com> <CALwzid=vaj1Hj_OTVMYCwXub4=bQEqrV=hC+YYmCXctvAqXtsw@mail.gmail.com> <CAPTjJmrD28nS=tj_bm_SkwuqLNSY4F_RAKpKAWTYNh9x6RtBCQ@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Sun, 8 Jun 2014 11:24:28 -0600
Subject Re: Uniform Function Call Syntax (UFCS)
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.10890.1402249956.18130.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1402249956 news.xs4all.nl 2967 [2001:888:2000:d::a6]:37376
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:72982

Show key headers only | View raw


On Sun, Jun 8, 2014 at 11:13 AM, Chris Angelico <rosuav@gmail.com> wrote:
> On Mon, Jun 9, 2014 at 3:08 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
>> On Sun, Jun 8, 2014 at 10:48 AM, Chris Angelico <rosuav@gmail.com> wrote:
>>> Except that it's even more complicated than that, because hasattr
>>> wasn't defined in your module, so it has a different set of globals.
>>> In fact, this would mean that hasattr would become quite useless.
>>
>> hasattr is a builtin, so it has no globals at all.  It would have to
>> use the calling scope for UFCS resolution as in my example
>> implementation.
>
> Same difference. It can't simply look for the name in globals(), it
> has to figure out based on the caller's globals.

But that would all be done in getattr, so I don't think it affects
hasattr's implementation at all.  Since hasattr doesn't push anything
onto the stack, getattr doesn't have to care whether it was called
directly from Python or indirectly via getattr; either way the scope
it needs is just the top frame of the stack.

Could be a different matter in other implementations, though.

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


Thread

Uniform Function Call Syntax (UFCS) jongiddy <jongiddy@gmail.com> - 2014-06-06 23:45 -0700
  Re: Uniform Function Call Syntax (UFCS) Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-07 13:20 -0600
    Re: Uniform Function Call Syntax (UFCS) Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-06-08 13:27 +1200
      Re: Uniform Function Call Syntax (UFCS) jongiddy <jongiddy@gmail.com> - 2014-06-08 01:26 -0700
        Re: Uniform Function Call Syntax (UFCS) Paul Sokolovsky <pmiscml@gmail.com> - 2014-06-08 15:06 +0300
          Re: Uniform Function Call Syntax (UFCS) Marko Rauhamaa <marko@pacujo.net> - 2014-06-08 18:56 +0300
            Re: Uniform Function Call Syntax (UFCS) Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-08 10:38 -0600
            Re: Uniform Function Call Syntax (UFCS) Paul Sokolovsky <pmiscml@gmail.com> - 2014-06-08 19:40 +0300
            Re: Uniform Function Call Syntax (UFCS) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-09 04:33 +0000
              Re: Uniform Function Call Syntax (UFCS) Marko Rauhamaa <marko@pacujo.net> - 2014-06-09 09:25 +0300
                Re: Uniform Function Call Syntax (UFCS) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-09 09:09 +0000
                Re: Uniform Function Call Syntax (UFCS) Chris Angelico <rosuav@gmail.com> - 2014-06-09 19:13 +1000
                Re: Uniform Function Call Syntax (UFCS) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-09 13:37 +0000
                Re: Uniform Function Call Syntax (UFCS) Chris Angelico <rosuav@gmail.com> - 2014-06-10 01:08 +1000
          Re: Uniform Function Call Syntax (UFCS) jongiddy <jongiddy@gmail.com> - 2014-06-08 09:24 -0700
            Re: Uniform Function Call Syntax (UFCS) jongiddy <jongiddy@gmail.com> - 2014-06-08 09:34 -0700
            Re: Uniform Function Call Syntax (UFCS) Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-08 10:54 -0600
            Re: Uniform Function Call Syntax (UFCS) Chris Angelico <rosuav@gmail.com> - 2014-06-09 03:10 +1000
              Re: Uniform Function Call Syntax (UFCS) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-09 03:20 +0000
                Re: Uniform Function Call Syntax (UFCS) Chris Angelico <rosuav@gmail.com> - 2014-06-09 13:44 +1000
                Re: Uniform Function Call Syntax (UFCS) jongiddy <jongiddy@gmail.com> - 2014-06-08 23:38 -0700
                Re: Uniform Function Call Syntax (UFCS) Roy Smith <roy@panix.com> - 2014-06-08 23:45 -0400
      Re: Uniform Function Call Syntax (UFCS) jongiddy <jongiddy@gmail.com> - 2014-06-08 02:25 -0700
        Re: Uniform Function Call Syntax (UFCS) Roy Smith <roy@panix.com> - 2014-06-08 10:59 -0400
          Re: Uniform Function Call Syntax (UFCS) jongiddy <jongiddy@gmail.com> - 2014-06-08 08:39 -0700
            Re: Uniform Function Call Syntax (UFCS) Chris Angelico <rosuav@gmail.com> - 2014-06-09 02:48 +1000
              Re: Uniform Function Call Syntax (UFCS) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-09 03:53 +0000
                Re: Uniform Function Call Syntax (UFCS) Chris Angelico <rosuav@gmail.com> - 2014-06-09 14:53 +1000
                Re: Uniform Function Call Syntax (UFCS) Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-09 08:24 -0600
                Re: Uniform Function Call Syntax (UFCS) jongiddy <jongiddy@gmail.com> - 2014-06-09 23:43 -0700
            Re: Uniform Function Call Syntax (UFCS) Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-08 11:08 -0600
            Re: Uniform Function Call Syntax (UFCS) Chris Angelico <rosuav@gmail.com> - 2014-06-09 03:13 +1000
            Re: Uniform Function Call Syntax (UFCS) Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-08 11:24 -0600
              Re: Uniform Function Call Syntax (UFCS) jongiddy <jongiddy@gmail.com> - 2014-06-08 13:35 -0700
    Re: Uniform Function Call Syntax (UFCS) jongiddy <jongiddy@gmail.com> - 2014-06-08 01:15 -0700
      Re: Uniform Function Call Syntax (UFCS) Paul Sokolovsky <pmiscml@gmail.com> - 2014-06-08 14:52 +0300
      Re: Uniform Function Call Syntax (UFCS) Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-08 11:00 -0600

csiph-web