Adding a method to an instance
urner at alumni.princeton.edu
Sat Mar 3 07:24:35 CET 2001
Kirby Urner <urner at alumni.princeton.edu> wrote:
>In saying f.__class__, you point back to the superclass foo.
>If you want to poke newMethod into object f alone, then you
>should just go:
>f = newMethod
f.newMethod = newMethod
-- you need to have a method name on the receiving end, lest
you rebind f entirely, my mistake.
The ensuing example was more correct.
More information about the Python-list