Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'true,': 0.05; 'attribute': 0.07; 'lookup': 0.09; 'subject:Function': 0.09; 'cc:addr:python- list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'latter,': 0.16; 'semantics': 0.16; 'squared': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'looked': 0.18; 'obviously': 0.18; 'cc:addr:python.org': 0.22; '(by': 0.24; 'certainly': 0.24; 'mon,': 0.24; 'together.': 0.24; 'cc:2**0': 0.24; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'statement': 0.30; 'message- id:@mail.gmail.com': 0.30; '(which': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'yes.': 0.31; 'entirely': 0.33; 'could': 0.34; 'problem': 0.35; 'subject: (': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'false': 0.36; 'found.': 0.36; 'possible': 0.36; 'should': 0.36; 'whatever': 0.38; 'pm,': 0.38; 'does': 0.39; 'how': 0.40; 'even': 0.60; 'up,': 0.60; 'kind': 0.63; 'different': 0.65; 'within': 0.65; 'direct': 0.67; 'coherent': 0.84; 'why?': 0.91; '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=z2rJYFXocADGkFTclwOS7nKe2DByopsSx83htBFzVrg=; b=YDRDVNiFMGOdfa48Asr9G513W9XgbP7LK9Bdpn8oju+eVRNMA9qFdC6VIOELPtQiLv h1OCQBNgu0ytHWfo/FdZxFJs4u7nMhgF7blR0PrG8Cp/hS1yMz0Nxx01k0ES0UHWylJO du1OkUTZTL993S4F2N5xxUgiCCf5+UiyJ0fJbYRaVBbJ+iPxzY0GB/OkGMzmOnogxV6X E6IVRLydEVf422K4XGjRI8M1jUoQbCrbYcefeFfDgJ3Ops35vMOb0h34AvgV2XcDcwWY EVrcIbdvhfAGIJAYDHOdxYaRWCoWjYF4z5nZ4DGR+LFFk9tocF4fREdLNRKY1mWYYeIo nnYA== MIME-Version: 1.0 X-Received: by 10.220.182.5 with SMTP id ca5mr1013037vcb.50.1402289617286; Sun, 08 Jun 2014 21:53:37 -0700 (PDT) In-Reply-To: <53952fa9$0$29988$c3e8da3$5496439d@news.astraweb.com> References: <8b96ae27-20fa-4df9-807e-c806fed983c0@googlegroups.com> <1dd863ba-09e5-439b-8669-db65f3e999eb@googlegroups.com> <927afb61-be0e-43a1-8aab-107e77a013fc@googlegroups.com> <53952fa9$0$29988$c3e8da3$5496439d@news.astraweb.com> Date: Mon, 9 Jun 2014 14:53:37 +1000 Subject: Re: Uniform Function Call Syntax (UFCS) 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.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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1402289625 news.xs4all.nl 2910 [2001:888:2000:d::a6]:43504 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:73007 On Mon, Jun 9, 2014 at 1:53 PM, Steven D'Aprano wrote: >> which means that hasattr (which is defined by >> attempting to get the attribute and seeing if an exception is thrown) >> has to return True. > > Yes. And this is a problem why? > > Obviously it would mean that the semantics of hasattr will be different > than they are now, but it's still a coherent set of semantics. Coherent perhaps, but in direct opposition to the OP's statement about how hasattr should return False even if there's a global to be found. A coherent meaning for this kind of thing would almost certainly not be possible within the OP's requirements, although it's entirely possible something sensible could be put together. (By the way, would (3).squared return a curried reference to squared as of when you looked it up, or would it return something that late-binds to whatever 'squared' is in scope as of when you call it? If the latter, then hasattr would have to always return True, and getattr would have to return something that does the late-bind lookup and turns NameError into AttributeError.) ChrisA