[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] QWidget call other __init__ methods, but why?
From:       Barry Scott <barry () barrys-emacs ! org>
Date:       2016-06-30 11:15:03
Message-ID: 9080D8F1-397A-4534-AF6A-D49066212C1A () barrys-emacs ! org
[Download RAW message or body]


> On 28 Jun 2016, at 18:36, Phil Thompson <phil@riverbankcomputing.com> wrote:
> 
> On 28 Jun 2016, at 6:20 pm, Barry Scott <barry@barrys-emacs.org> wrote:
>> 
>>> On 28 Jun 2016, at 18:11, Phil Thompson <phil@riverbankcomputing.com> wrote:
>>> 
>>> You've missed out calls to super().__init__(**kwds)
>> 
>> Are you suggesting the python has code in super() to see that I use **kwds
>> and call more then one __init__?
>> 
>> You mean like this?
>> 
>> class Person(QObject, Age):
>>   def __init__( self, name='', **kwds ):
>>       print( 'instance of Person.__init__' )
>>       print( kwds )
>>       super().__init__( **kwds )
>> 
>>       self.name = name
>> 
>> It gets this error:
>> 
>> TypeError: __init__() got an unexpected keyword argument 'age'
> 
> ...because you've missed out calls to super().__init__(**kwds)
> 
> See below.


Oh! I going to have to reread all the python docs.

I did not see this described, something I'll take up with python folks.
I'm sure I'm not the first python developer to be surprised by this.

Thanks for taking the time to explaining this.

Barry

> 
> Phil
> 
> <qqq.py>

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic