Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.04; '-for': 0.05; 'subject:Python': 0.06; '*args,': 0.09; 'subject:method': 0.09; 'subject:set': 0.09; 'cc:addr:python- list': 0.11; 'def': 0.12; '**kwds)': 0.16; '**kwds):': 0.16; 'runtime.': 0.16; 'subject:Dev': 0.16; 'wrote:': 0.18; 'subject:] ': 0.20; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'skip': 0.24; 'define': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'cc:2**2': 0.30; 'message-id:@mail.gmail.com': 0.30; 'workaround': 0.31; 'skip:_ 10': 0.34; 'could': 0.34; 'received:google.com': 0.35; 'method': 0.36; 'nov': 0.38; 'pm,': 0.38; 'different': 0.65; 'to:addr:gmail.com': 0.65 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:to :cc:content-type; bh=+ia4lCcpWo/tUQnYxmB5t/DEuCtmRXLptgPmIMcH9Jc=; b=ZNOM851lVJju39zy10JDfl7PbAvASmfMDhVrELz+XH0EBYQ8hzNvx8WxzCkJ2WxIbJ VTnM3/YkB9Ek2Uvnj68pdo7syfJk3Axr/LzTWNqmnlGGGmcB0r+7DbsXDaAkmpLeukhd OsmCDBfnlSFbhYvdP89FZIx6IWDWAWjbA5D8Vn2+VaRD5AghDzuYPhrXz9pZlNPAfQn6 /FN7rA8aGV9EUZ/FcG4v4tvo1Xh8MFuKg6WYXoSPjO66f+S43N6N7VorwAeIleDG1Ygo M9v+S2CINMRpx64rzCsNQPIT3NV3twKPvQe6Bq52RzoJYrXijLC69YjsPdC2pKXN1Hzz 5+hw== MIME-Version: 1.0 X-Received: by 10.107.130.98 with SMTP id e95mr4119107iod.87.1415127964361; Tue, 04 Nov 2014 11:06:04 -0800 (PST) In-Reply-To: References: <545919B6.7040007@stoneleaf.us> Date: Tue, 4 Nov 2014 13:06:04 -0600 Subject: Re: [Python-Dev] Dinamically set __call__ method From: Skip Montanaro To: =?UTF-8?Q?Roberto_Mart=C3=ADnez?= Content-Type: multipart/alternative; boundary=001a113ec986a0c3fb05070d27c5 Cc: Python , Nathaniel Smith 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: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415127972 news.xs4all.nl 2894 [2001:888:2000:d::a6]:57020 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 5040 X-Received-Body-CRC: 911799969 Xref: csiph.com comp.lang.python:80219 --001a113ec986a0c3fb05070d27c5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 valid > for my case because I want to change the *signature* of the function also > -for introspection reasons. You could define __call__ like so: def __call__(self, *args, **kwds): self._my_call(*args, **kwds) then set self._my_call at runtime. Skip --001a113ec986a0c3fb05070d27c5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On Tue, Nov 4, 2014 at 1:01 PM, Roberto Mart=C3=ADnez <= ;robertomar= tinezp@gmail.com> wrote:
Th= e workaround of calling a different method inside __call__ is not valid for= my case because I want to change the *signature* of the function also -for= introspection reasons.

You could define __call__ lik= e so:

= def __call__(self, *args, **kwds):
=C2=A0 = =C2=A0 self._my_call(*args, **kwds)

then set self._my_call at runtime.

Skip

--001a113ec986a0c3fb05070d27c5--