Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'attribute': 0.07; 'method.': 0.07; 'assumed': 0.09; 'mind,': 0.09; 'solution,': 0.09; 'subject:()': 0.09; 'cc:addr:python-list': 0.11; '24,': 0.16; 'shorthand': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'string,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'possibility': 0.29; 'message-id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'steven': 0.31; 'quite': 0.32; '"the': 0.34; 'except': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'accessing': 0.36; "didn't": 0.36; 'nov': 0.38; 'first': 0.61; 'subject:skip:o 10': 0.84; '2013': 0.98 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 :cc:content-type; bh=kFcT9IvysvpQp0wDQIWktK+hRj8xlUMH3TzR5JpsgN4=; b=nDgLK/jmt8HaUtTtfwgJN9a3rd+HJVClLNJ0lNglx9+zs+RX9p5l7RCXs6k48K+RNr iy4UCJIZAZ55MqQdPeqH8A5vVSJS87Gi50TmcHpyUqFGaalHWwvKO85myr8eBO/HcaDL CkIH+nbsKVnY2Z2pH497GCiqocs/Lh+rnKK/aovODFhQKD8lbRp+aRbj9baNo1Zcq/ie /4zbvVQ/w1b6VSPtiwb58rUyCRPmmlII3MCy6O2uHNa1XR3aEm51MCZQ69bTfJPHpDN1 +Mb8ccfeAGJLx8ZDcJ/Znc6CpxpOUG2hzOXXqNTsjOLq5TAgfOPVrUSMB4aBgzyXX+nH XlJQ== X-Received: by 10.49.99.98 with SMTP id ep2mr38511349qeb.9.1385301881244; Sun, 24 Nov 2013 06:04:41 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <529202e3$0$29993$c3e8da3$5496439d@news.astraweb.com> References: <529202e3$0$29993$c3e8da3$5496439d@news.astraweb.com> From: Devin Jeanpierre Date: Sun, 24 Nov 2013 06:04:01 -0800 Subject: Re: Implement logic on object.attribute and object.attribute() To: "Steven D'Aprano" Content-Type: text/plain; charset=UTF-8 Cc: "comp.lang.python" 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1385301889 news.xs4all.nl 15983 [2001:888:2000:d::a6]:33233 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:60367 On Sun, Nov 24, 2013 at 5:45 AM, Steven D'Aprano wrote: > On Sun, 24 Nov 2013 05:04:16 -0800, Devin Jeanpierre wrote: >> Uh oh. What you want is impossible. You cannot call an attribute without >> first accessing it. :( > > Not quite impossible. All you need is an object that behaves like a > string, except it has a __call__ method. Here's a sketch of a solution, > completely untested. I admit that thought crossed my mind, but I assumed he didn't want a GET+POST, and also "impossible" is often a nice shorthand for "the possibility is extraordinarily awful". -- Devin