Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3a.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; 'subject:: [': 0.04; '-for': 0.05; 'subject:Python': 0.06; '*args,': 0.09; 'arguments': 0.09; 'overflow': 0.09; 'subject:method': 0.09; 'subject:set': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'suggest': 0.14; 'thread': 0.14; '**kwds)': 0.16; '**kwds):': 0.16; 'descending': 0.16; 'from:addr:pobox.com': 0.16; 'higher-level': 0.16; 'metaclasses': 0.16; 'subject:Dev': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'stack': 0.19; 'subject:] ': 0.20; 'seems': 0.21; '>>>': 0.22; 'cc:addr:gmail.com': 0.22; 'cc:addr:python.org': 0.22; 'either.': 0.24; 'rapidly': 0.24; 'skip': 0.24; '(or': 0.24; 'define': 0.26; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'function': 0.29; 'ideal': 0.29; 'cc:2**2': 0.30; 'message-id:@mail.gmail.com': 0.30; 'towards': 0.31; 'informative': 0.31; 'names.': 0.31; 'workaround': 0.31; 'guess': 0.33; 'skip:_ 10': 0.34; "i'd": 0.34; 'could': 0.34; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'in:': 0.36; 'method': 0.36; 'url:org': 0.36; 'received:209': 0.37; 'starting': 0.37; 'implement': 0.38; 'nov': 0.38; 'pm,': 0.38; 'university': 0.39; 'called': 0.40; 'new': 0.61; "you're": 0.61; 'first': 0.61; 'strategy': 0.64; 'different': 0.65; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'smith': 0.68; 'edinburgh': 0.91 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=IR180OE+nMFPeYQ+xExaMAAG7mxj1SjaySir7N9cMG0=; b=IQhv0JVIdmYa2ZNxQ8QAkZkF3mnA7H3tCSzGLwHDvQkgbRsEDibfVlqppcGTfP0Cu5 ecxYXjhqQ5+5PabXCkprR3TFu5WR+0dmLmWMcZpVxZa8d1BHOsFRLI+Db/KRU2I+MoNe +mfY5OYjfw1AQTsJ4/Kfhkpvpbxl/yHQX0jHKFGxV077dkQ7e8J8MakMNpJjoCLPsCSx u1emH8XnIeaJ/X24lWB5UIc03yLOnBlMmD+2tFvr1n9SqhRgBoE/I+musADN6eRm+NEF to8j/BuxJn+muINSRA0VZEhH0NqPuxARCfZDH/yDXQVxgaris7UjR/KrIGRCiQYiNsN9 nWZg== X-Gm-Message-State: ALoCoQljJvx9N+ES+dmq8GDG1DPJWzm5k6V8zNcadZrFM8H81eqkGpOGxmbBrsD6B+QRK8RhUhMp MIME-Version: 1.0 X-Received: by 10.202.104.85 with SMTP id d82mr31521678oic.4.1415128983276; Tue, 04 Nov 2014 11:23:03 -0800 (PST) Sender: njs@vorpus.org In-Reply-To: References: <545919B6.7040007@stoneleaf.us> Date: Tue, 4 Nov 2014 19:23:03 +0000 X-Google-Sender-Auth: chyHos1GSxVPDIxxghVmKJLFzrw Subject: Re: [Python-Dev] Dinamically set __call__ method From: Nathaniel Smith To: =?UTF-8?Q?Roberto_Mart=C3=ADnez?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: 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: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415128992 news.xs4all.nl 2903 [2001:888:2000:d::a6]:42621 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80224 On Tue, Nov 4, 2014 at 7:15 PM, Roberto Mart=C3=ADnez wrote: > > > On Tue, Nov 4, 2014 at 8:06 PM, Skip Montanaro > wrote: >> >> >> On Tue, Nov 4, 2014 at 1:01 PM, Roberto Mart=C3=ADnez >> wrote: >>> >>> The workaround of calling a different method inside __call__ is not val= id >>> for my case because I want to change the *signature* of the function al= so >>> -for introspection reasons. >> >> >> You could define __call__ like so: >> >> def __call__(self, *args, **kwds): >> self._my_call(*args, **kwds) > > > This was my first approach, but it is not very informative to the user an= d I > prefer to have arguments with descriptive names. We have to change __doc_= _ > too, so this is not an ideal solution for me. > > I tried to implement __getattribute__, but is not called either. :( I'd suggest starting a new thread on python-list (or stack overflow or whatever) explaining what the heck you're trying to do here and asking for higher-level advice/suggestions, because your current implementation strategy seems to have placed you on a path that is rapidly descending past "spaghetti" towards "tentacular". (Or alternatively I guess you could go all in: I=C3=A4! I=C3=A4! Metaclasse= s Fhtagn!) -n --=20 Nathaniel J. Smith Postdoctoral researcher - Informatics - University of Edinburgh http://vorpus.org