On Tue, 2003-02-25 at 12:31, Guido van Rossum wrote: > > I've tried this, but then I was unable to create any of the > > old-style classes. Is there any solution that would let me mutate > > an object into both? I suspect not. Then the question is: > > No, you can never switch an object from classic to new-style. One possibility, which isn't quite the same thing, is to derive a new-style class from the classic class. You can write this with a class statement like so: import cgi class FormContent(cgi.FormContent, object): pass or you can generate one manually: type.__new__(type, "FormContent", (cgi.FormContent, object), {}) In either case, you will have a new-style class that inherits all of its behavior from the classic class. Jeremy
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