Re: [Python-Dev] Dinamically set __call__ method

2014-11-04 Thread Skip Montanaro
On Tue, Nov 4, 2014 at 10:52 AM, Roberto Martínez < robertomartin...@gmail.com> wrote: > $ cat testcall.py > class A: > You are using old-style classes in Python 2.7 unless you explicitly inherit from object. If I vary the class line to be "class A(object):" I get the same behavior with 2.7 as yo

Re: [Python-Dev] Dinamically set __call__ method

2014-11-04 Thread Ethan Furman
This list is for the development _of_ Python, not development _with_ Python. Try asking on Python List. (forwarding...) On 11/04/2014 08:52 AM, Roberto Martínez wrote: I am trying to replace dinamically the __call__ method of an object using setattr. Example: $ cat testcall.py class A:

Re: [Python-Dev] Dinamically set __call__ method

2014-11-04 Thread Nathaniel Smith
On Tue, Nov 4, 2014 at 4:52 PM, Roberto Martínez wrote: > Hi folks, > > I am trying to replace dinamically the __call__ method of an object using > setattr. > Example: > > $ cat testcall.py > class A: > def __init__(self): > setattr(self, '__call__', self.newcall) > > def __call__(

[Python-Dev] Dinamically set __call__ method

2014-11-04 Thread Roberto Martínez
Hi folks, I am trying to replace dinamically the __call__ method of an object using setattr. Example: $ cat testcall.py class A: def __init__(self): setattr(self, '__call__', self.newcall) def __call__(self): print("OLD") def newcall(self): print("NEW") a=A(