Kamilche,

On Fri, 28 Jan 2005 08:10:07 -0800 (PST), Kamilche
<[EMAIL PROTECTED]> wrote:
> I see what you're attempting to do. However, your code, if it DID run,
> would result in a method being added to the object, not the object's
> class! Modify the class itself, not the object, as follows:
> 
> |class Test:
> |    def __init__(self):
> |        self.method()
> |
> |def m(self):
> |    print self
> |
> |setattr(Test, 'method', m)
> |Test()
> 

beautiful; so this appears to be equivalent to the __class__ method
that Hans suggested.

Thanks a lot.

Peace
Bill Mill
bill.mill at gmail.com

> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to