Adding a method to an instance
Kirby Urner
urner at alumni.princeton.edu
Sat Mar 3 01:24:35 EST 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
>
Sorry,
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.
Kirby
More information about the Python-list
mailing list