super bug?
Michal Wallace
sabren at manifestation.com
Mon Jan 28 11:09:17 EST 2002
Hey all,
>>> print super.__doc__
super(type) -> unbound super object
super(type, obj) -> bound super object; requires isinstance(obj, type)
super(type, type2) -> bound super object; requires issubclass(type2, type)
Typical use to call a cooperative superclass method:
class C(B):
def meth(self, arg):
super(C, self).meth(arg)
## BUT....
>>> 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
Am I misunderstanding the docstring, or is this a bug?
Cheers,
- Michal http://www.sabren.net/ sabren at manifestation.com
------------------------------------------------------------
Give your ideas the perfect home: http://www.cornerhost.com/
cvs - weblogs - php - linux shell - perl/python/cgi - java
------------------------------------------------------------
More information about the Python-list
mailing list