"Super()" confusion

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Feb 10 19:28:46 EST 2009


En Tue, 10 Feb 2009 18:01:53 -0200, Daniel Fetchinson  
<fetchinson at googlemail.com> escribió:
> On 2/9/09, Gabriel Genellina <gagsl-py2 at yahoo.com.ar> wrote:
>> En Mon, 09 Feb 2009 23:34:05 -0200, Daniel Fetchinson
>> <fetchinson at googlemail.com> escribió:
>>
>>>>>> Consider whether you really need to use super().
>>>>>> http://fuhm.net/super-harmful/
>>>
>>> Because throwing around that link carries about the same amount of
>>> information as "perl is better than python", "my IDE is better than
>>> yours", "vim rulez!", "emacs is cooler than vim", etc, etc.
>>
>> Not at all. It contains accurate and valuable information that isn't
>> available elsewhere.
>
> But does not contain other valuable information which would demystify
> super. If only this source is shown to a person who wants to learn the
> proper usage of super, the impression he/she gets will be distorted.

Why so? At the end there is a "best practices" recipe that pretty much  
summarizes the proper usage of super, and AFAIK it's the right way to use  
it. Don't you agree with any of the conclusions?

> Example: 1. somebody asks about threading 2. reply comes: there is a
> GIL! you can't do real threading. Now this reply might be technically
> more-or-less correct, it is misleading and does not help the poster.
> An informed discussion of the various solutions that does not involve
> a rant about the GIL would be very useful though.

As I said, the article presents a "recipe" for super() usage, and I'd  
consider it very helpful. It's far from just saying "super s*cks!", or  
"the GIL s*cks!" or something like that.

> You might want to start with
>
> http://www.artima.com/weblogs/viewpost.jsp?thread=236275

...which, although the author says it was written a long time ago, was not  
published until less than six months ago, and has very low visibility.

> You are right, it's not in the documentation. But if somebody asks on
> c.l.p the appropriate answer, I think, is to point to information such
> as the one above, and not the misleading "harmful" essay.

According to Google, nobody has menctioned the "harmful" essay in this  
group since April 2008 [1], months before Simionato's article were  
available... So this is the *first* time the reference to the former essay  
could have been replaced by M.S.' one... don't be so strict!

Anyway, the right thing to do, IMHO, is to publish correct and accurate  
documentation in the main Python site. Not everybody knows about this  
group existence, nor has the time/experience/interest on subscribe here,  
post a question and wait for an answer. I've seen some posts in python-dev  
saying something like "this is confusing, we should evangelize people on  
c.l.p. on the right way to do it" and I completely disagree; the right  
place for such things is the product documentation, or -to a much lesser  
degree because it's online only- some article collection linked from the  
main site (like the "Other resources" left bar, already present).

>>> Honestly, I don't understand how this thing got so much out of
>>> control. If anyone starts an intelligent question or remark about
>>> super, this essay is thrown in no matter what. Anyone can explain why?
>>
>> Because for a very loooooong time (seven years, 2001-2008) super was
>> almost undocumented. The Library Reference -before release 2.6- only  
>> had a short paragraph, the [...]
>
> You are right, the documentation needs some work in this regard. But
> again, just because some sources are not in the documentation doesn't
> mean that the most opinionated essay is the best source. A little
> search turns up much more useful ones.

(not according to Google [2]: I get the "harmful" article in the top, the  
thread in python-dev, a couple threads in c.l.p including posts by M.S.,  
his article in artima, and nothing more relevant than "Monty Python Super  
Star" up to the 3rd page)

*Now* that *I* am aware of the recent article series by M.S., the next  
time someone asks *me* about super(), probably I'll refer her to both M.S.  
and J.K.'s articles. Last time I checked (perhaps one or two years ago),  
the "harmful" article was almost the only relevant source of info about  
super().

[1]  
http://groups.google.com/group/comp.lang.python/search?q=super+harmful&start=0&scoring=d&
[2] http://www.google.com/search?q=python+super

-- 
Gabriel Genellina




More information about the Python-list mailing list