X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 78.192.65.63 Path: csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!news.muarf.org!news.roellig-ltd.de!open-news-network.org!border2.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed2.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'operator': 0.03; 'syntax': 0.04; 'element': 0.07; 'nested': 0.07; 'operator,': 0.09; 'ron': 0.09; 'uses.': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; "wouldn't": 0.14; '"n"': 0.16; 'adam': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'scope.': 0.16; 'subject:operators': 0.16; 'syntactic': 0.16; 'wrote:': 0.18; 'implementing': 0.19; 'resolved': 0.19; 'cc:addr:python.org': 0.22; 'fairly': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'operators': 0.31; 'could': 0.34; "can't": 0.35; 'something': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'similar': 0.36; 'error.': 0.37; 'wrong': 0.37; 'implement': 0.38; 'pm,': 0.38; 'sure': 0.39; 'called': 0.40; 'most': 0.60; 'course': 0.61; 'effectively': 0.66; 'special': 0.74; '2015': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=sT337pRm8KCgT/UHs2a1IG4g8TLNtoMpz3ndnpYQnhQ=; b=P+A3Qf/Sa1yQrRuQgl7vX5XfmRqZKYAQVdhN0iMAOUVzDzaF00xgpLarvrM5kEJPrK 22380w6w1T1OUUaUh/FC9wXFWMXr1Y51X1Bm47mziMKTHhU4D4LVUBXMy13/L2+xvPkO nkrwkp6uXMA7c3wuGn2P5cllyXVbVi1yCjvPN9ACJr7fhmqiE1UsghWd3n33jZQsvmIW QI1iEiEf8wAS8qt8VMTPNN/fLYPoGmmXfIJ1iwaz7xUmubyw9EcPx01Ghb61tDfseoGi XyaqfVSnLwc8SAokWm1gqvRHJu2i5uhZ/pPevEzuzy7dlW4vv5qUWl2hnUZhmDX5mWit Jeog== MIME-Version: 1.0 X-Received: by 10.43.39.1 with SMTP id tk1mr11180044icb.26.1432016735918; Mon, 18 May 2015 23:25:35 -0700 (PDT) In-Reply-To: References: <55579886.3010001@cdreimer.com> Date: Tue, 19 May 2015 16:25:35 +1000 Subject: Re: Rule of order for dot operators? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1432016739 news.xs4all.nl 2922 [2001:888:2000:d::a6]:46055 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:90827 On Tue, May 19, 2015 at 12:43 PM, Ron Adam wrote: > Having just implementing something similar for nested scopes, it turns out > it can't be operators because if it was, then the names y and z would be > resolved in the wrong scope. > > y = "m" > z = "n" > a = x . y . z > > Which of course wouldn't do what we want. > > a = x . "m" . "n" > > And most likely this would give an error. If you want to implement the dot as an operator, you could do it by having a special syntactic element called an "atom", which is used for these kinds of identifier-like tokens. The dot operator could then take an object and an atom, and effectively return getattr(obj, stringify(atom)). I'm fairly sure this would result in the same syntax as Python uses. ChrisA