En Tue, 11 Aug 2009 20:21:16 -0300, Nikolaus Rath
escribió:
Bruno Desthuilliers writes:
7stud a écrit :
(snip)
class Wrapper(object):
def __init__(self, obj, func):
self.obj = obj
self.func = func
def __call__(self, *args):
return self.func(*args)
def
Bruno Desthuilliers writes:
> 7stud a écrit :
> (snip)
>> class Wrapper(object):
>> def __init__(self, obj, func):
>> self.obj = obj
>> self.func = func
>>
>> def __call__(self, *args):
>> return self.func(*args)
>>
>> def __getattr__(self, name):
>> ret
7stud a écrit :
(snip)
class Wrapper(object):
def __init__(self, obj, func):
self.obj = obj
self.func = func
def __call__(self, *args):
return self.func(*args)
def __getattr__(self, name):
return object.__getattribute__(self.obj, name)
This should b
On Aug 9, 1:02 pm, Nikolaus Rath wrote:
> Hi,
>
> I want to monkeypatch an object so that it becomes callable, although
> originally it is not meant to be. (Yes, I think I do have a good reason
> to do so).
>
> But simply adding a __call__ attribute to the object apparently isn't
> enough, and I d
On Aug 9, 12:02 pm, Nikolaus Rath wrote:
> Hi,
>
> I want to monkeypatch an object so that it becomes callable, although
> originally it is not meant to be. (Yes, I think I do have a good reason
> to do so).
>
> But simply adding a __call__ attribute to the object apparently isn't
> enough, and I
Nikolaus Rath schrieb:
Hi,
I want to monkeypatch an object so that it becomes callable, although
originally it is not meant to be. (Yes, I think I do have a good reason
to do so).
But simply adding a __call__ attribute to the object apparently isn't
enough, and I do not want to touch the class
Hi,
I want to monkeypatch an object so that it becomes callable, although
originally it is not meant to be. (Yes, I think I do have a good reason
to do so).
But simply adding a __call__ attribute to the object apparently isn't
enough, and I do not want to touch the class object (since it would
mo