Fernando RodrÃguez wrote: > Is it possible to change an object's class in runtime? O:-) Yes, but you should be worried if that seems like a good idea. There's usually a better solution. But if you insist: >>> class Flub: ... def flubber(self): ... print "Flub" ... >>> class Ber: ... def flubber(self): ... print "Ber" ... >>> f = Flub() >>> f.flubber() Flub >>> f.__class__ = Ber >>> f.flubber() Ber >>> -Steve -- Steve Purcell, Pythangelist Get testing at http://pyunit.sourceforge.net/ Any opinions expressed herein are my own and not necessarily those of Yahoo
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4