super bug?
Pedro Rodriguez
pedro_rodriguez at club-internet.fr
Mon Jan 28 11:22:07 EST 2002
"Michal Wallace" <sabren at manifestation.com> wrote:
>>>> class B:
> ... def meth(self, arg):
> ... print arg
> ...
>>>> class C(B):
> ... def meth(self, arg):
> ... super(C, self).meth(arg)
> ...
>>>> C().meth("huh?")
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "<stdin>", line 3, in meth
> TypeError: super() argument 1 must be type, not class
>
New style class => 'object' subclassing
(wondering how many times we will get caught by this ;).
class B(object): # !!!
def meth(self, arg):
print arg
class C(B):
def meth(self, arg):
super(C, self).meth(arg)
C().meth("huh?")
Hope this helps,
--
Pedro
More information about the Python-list
mailing list