"Kent Johnson" <[EMAIL PROTECTED]> wrote > Alan Gauld wrote: >> I'm not sure about adding methods at run time, I've never > Sure it works: > > In [1]: class foo(object): pass > ...: > In [4]: def show(self): print "Hi, I'm a foo" > > In [5]: foo.show=show > > In [6]: f.show() > Hi, I'm a foo
Cool! I'm constantly amazed at the power and simplicity of Python. > More advanced explanation: Yes, it makes sense when its explained. But I'd never have intuitively thought of that! Thanks for the info Kent. Alan G. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor