Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80219

Re: [Python-Dev] Dinamically set __call__ method

References <CAF0TK51TKs+tw=u_rzrWVeSsDK7cOBt1Gcvq_izLfMObuDYNig@mail.gmail.com> <545919B6.7040007@stoneleaf.us> <CAF0TK52vw_SmqexN8RXyGs8GSKecPobK54ZqYPyKgRSSJy9zWw@mail.gmail.com>
Date 2014-11-04 13:06 -0600
Subject Re: [Python-Dev] Dinamically set __call__ method
From Skip Montanaro <skip.montanaro@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.15464.1415127972.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, Nov 4, 2014 at 1:01 PM, Roberto Martínez <robertomartinezp@gmail.com
> 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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: [Python-Dev] Dinamically set __call__ method Skip Montanaro <skip.montanaro@gmail.com> - 2014-11-04 13:06 -0600

csiph-web