Fwd: Things to Know About Super

Had a brief offline discussion with Michele - forwarding. ---------- Forwarded message ---------- From: michele.simionato@gmail.com <michele.simionato@gmail.com> Date: Mon, Aug 25, 2008 at 12:13 AM On Aug 24, 3:43 pm, "Matt Giuca" <matt.gi...@gmail.com> wrote:
Hi Michele,
Do you have a URL for this blog?
Sorry, here it is: http://www.artima.com/weblogs/index.jsp?blogger=micheles ---------- Forwarded message ---------- From: Matt Giuca <matt.giuca@gmail.com> Date: Mon, Aug 25, 2008 at 1:15 AM I skimmed (will read in detail later). As an "intermediate" (I'll describe myself as) Python developer, I tend not to use/understand super (I just call baseclassname.methodname(self,...) directly, so I guess I'm the target audience of this article. It's good - very informative and thorough. It's a bit too informal, personal, and opinionative to be used as "documentation" IMHO but it could certainly be cleaned up without being rewritten. Of interest though, is this: "The first sentence is just plain wrong: super does not return the superclass."
From what I remember of using super, this statement is true, and the documentation is wrong (or at least over-simplifies things). http://docs.python.org/dev/library/functions.html#super http://docs.python.org/dev/3.0/library/functions.html#super Perhaps this should be amended? (A brief statement to the effect of super creating a proxy object which can call the methods of any base class). It actually mentions the "super object" later, even though it claims to be returning the superclass.
Also Michele, looks as if super in Python 3 works about the same but has the additional feature of supporting 0 arguments, in which case it defaults to super(this_class, first_arg). (Does not create unbound super objects). Matt
participants (1)
-
Matt Giuca