super() doesn't get superclass

OKB (not okblacke) brenNOSPAMbarn at NObrenSPAMbarn.net
Thu Sep 20 12:56:55 EDT 2007


Steven D'Aprano wrote:

> class super(object)
> |  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 from the documentation on the website:

super(type[, object-or-type])
    Return the superclass of type.

    	I do think this should be changed, since it really isn't true.  It 
should probably say something like "return the next element after "type" 
in the MRO of "element-or-type".

-- 
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is
no path, and leave a trail."
	--author unknown



More information about the Python-list mailing list