[PyQt] When can I use 'super' and When I can not

Steven Woody narkewoody at gmail.com
Sat Jan 17 15:58:41 GMT 2009


On Fri, Jan 16, 2009 at 8:22 PM, Phil Thompson
<phil at riverbankcomputing.com> wrote:
> On Fri, 16 Jan 2009 09:01:35 +0800, Steven Woody <narkewoody at gmail.com>
> wrote:
>> On Thu, Jan 15, 2009 at 10:18 PM, Jason Voegele <jason at jvoegele.com>
> wrote:
>>> On Tuesday 13 January 2009 09:53:08 pm Steven Woody wrote:
>>>> In the book 'Rapid GUI Programming with Python and Qt',  chapter 5,
>>>> the author said that the 'super' method won't work in an example code,
>>>> that is a override 'accept()' method, in the end of the 'accept()'
>>>> method, one need to call base class's 'accept()' method.  But if you
>>>> write the code using something like 'super(.., self).accept(self)', it
>>>> will fail, you have to rather write it as QDialog.accept(self).   But
>>>> in the same example program, in the form's __init__() method, it does
>>>> use the 'super()' method without problem.
>>>>
>>>> So, my question is, in exactly what case I can not use super()?
> Thanks.
>>>
>>> My personal policy is to never use super() at all.  It has some subtle
>>> and
>>> dangerous behaviors that can really bite you if you're not careful.  See
>>> here:
>>>
>>>    http://fuhm.net/super-harmful/
>>>
>>
>> So much thanks for your paper.  If I am still curious about the answer
>> for my original question, would anyone help?  Thanks.
>
> It's to do with a conflict with the hackish implementation of super() (not
> doing attribute lookup in the normal way) and the way SIP implements lazy
> methods.
>
> Phil
>

so ... in what case can I use super() safely and in what case I can not?


More information about the PyQt mailing list