super question
sik0fewl
xxdigitalhellxx at hotmail.com
Mon Apr 7 15:18:43 EDT 2003
Danra wrote:
> Hi,
>
> I must be doing something wrong, but it seems that the typical use for
> the 'super' function, suggested in its help and in the python library
> refernce, does not work for me.
>
> Here's my experience with 'super':
>
>
>>>>class b:
>
> pass
>
>
>>>>class c(b):
>
> pass
>
>
>>>>super(c)
>
> Traceback (most recent call last):
> File "<pyshell#6>", line 1, in ?
> super(c)
> TypeError: super() argument 1 must be type, not classobj
>
>
>>>>super(c,c())
>
> Traceback (most recent call last):
> File "<pyshell#7>", line 1, in ?
> super(c,c())
> TypeError: super() argument 1 must be type, not classobj
>
> What am I doing wrong?
>
> P.S. pardon the pun in the question's subject :)
I'm not sure if this is what you're looking for, but here it is...
>>> class b:
... pass
...
>>> class c(b):
... pass
...
>>> super(type(c))
<super: <class 'class'>, NULL>
>>> super(type(c), c)
<super: <class 'class'>, <class object>>
I'm not even familiar with the function and didn't even look it up, but
maybe this is what you're looking for :)
--
Ryan
More information about the Python-list
mailing list