[Tutor] Adding method to class after class initialization

Stephan Richter srichter@cbu.edu
Fri, 17 Nov 2000 01:26:22 -0600

>If you define a method in a class, it is a "bound method", meaning that
>the self is passed automatically. Setting it as t.add=add means that t.add
>is just another variable, where its value happens to be a function.
>You can make new codeobjects with the 'new' module. Use new.instancemethod
> >>> t.add = new.instancemethod(add, t, Test)

THANK YOU. That was exactly what I needed. :-)


Stephan Richter
CBU - Physics and Chemistry Student
Web2k - Web Design/Development & Technical Project Management