On Wed, 10 Nov 2004 10:52:44 -0800, Mike Orr wrote:
> I'd like to use super() but Request is a classic class. :( I remember
> seeing a super() function somewhere that worked with either type of
> class, so I'm on the hunt for it.
Well, Request should be made new style. However, there is an hackish
solution that should work: convert the old style class to a new style one
by composing it with "object". Here is an example:
class Old:
def __init__(self):
print "Old.__init__"
class New(Old, object): # this is trick!
pass
class Mixin(object):
def __init__(self):
print "Mixin.__init__"
super(Mixin, self).__init__()
class C(Mixin, New):
def __init__(self):
print "C.__init__"
super(C, self).__init__()
print C.__mro__
c=C()
$ python super.py
(, , , , )
C.__init__
Mixin.__init__
Old.__init__
Michele Simionato