Allen a écrit :
[EMAIL PROTECTED] wrote:
On 26 juin, 17:18, Allen <[EMAIL PROTECTED]> wrote:
I need a way to add a method to an existing instance, but be as close as
possible to normal instance methods.
def set_method(obj, func, name=None):
if not name:
name = func.__name__
setattr(ob
[EMAIL PROTECTED] wrote:
On 26 juin, 17:18, Allen <[EMAIL PROTECTED]> wrote:
I need a way to add a method to an existing instance, but be as close as
possible to normal instance methods.
def set_method(obj, func, name=None):
if not name:
name = func.__name__
setattr(obj, name, func.__g
On 26 juin, 17:18, Allen <[EMAIL PROTECTED]> wrote:
> I need a way to add a method to an existing instance, but be as close as
> possible to normal instance methods.
def set_method(obj, func, name=None):
if not name:
name = func.__name__
setattr(obj, name, func.__get__(obj, type(obj)))
cl