[Python-bugs-list] [ python-Bugs-764003 ] super() does not work as documented
SourceForge.net
noreply@sourceforge.net
Tue, 01 Jul 2003 09:20:38 -0700
Bugs item #764003, was opened at 2003-07-01 17:18
Message generated for change (Comment added) made by doerwalter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=764003&group_id=5470
Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Bastian Kleineidam (calvin)
>Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: super() does not work as documented
Initial Comment:
According to the docs, I can use class names as type
object, but that does not work. Strange enough, this is
used in the python core modules (ie random.py):
> python2.3
Python 2.3b2 (#2, Jun 30 2003, 10:50:53)
[GCC 3.3.1 20030626 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> class a:
... def f (self):
... print 1
...
>>> class b(a):
... def f (self):
... super(b, self).f()
... print 2
...
>>> b().f()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<stdin>", line 3, in f
TypeError: super() argument 1 must be type, not classobj
----------------------------------------------------------------------
>Comment By: Walter Dörwald (doerwalter)
Date: 2003-07-01 18:20
Message:
Logged In: YES
user_id=89016
super() only works for new style classes. This doesn't seem
to be documented: neither in
http://www.python.org/dev/doc/devel/lib/built-in-funcs.html
nor in super.__doc__.
Assigning to Fred.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=764003&group_id=5470