Re: [Tutor] super constructor usage

2017-03-29 Thread Steven D'Aprano
On Wed, Mar 29, 2017 at 10:32:52PM +0100, Alan Gauld via Tutor wrote: > On 29/03/17 15:33, Rafael Knuth wrote: > > I am trying to wrap my head around the super constructor. > > This is one of these cases where it matters whether you > are using Python v2 or v3. Use of super in v3 is much >

Re: [Tutor] super constructor usage

2017-03-29 Thread Steven D'Aprano
On Wed, Mar 29, 2017 at 04:33:20PM +0200, Rafael Knuth wrote: > I am trying to wrap my head around the super constructor. Simple example: > > class A: > def __init__(self): > print("world") > > class B(A): > def __init__(self): > print("hello") > super(B,

Re: [Tutor] super constructor usage

2017-03-29 Thread Alan Gauld via Tutor
On 29/03/17 15:33, Rafael Knuth wrote: > I am trying to wrap my head around the super constructor. This is one of these cases where it matters whether you are using Python v2 or v3. Use of super in v3 is much easier. It looks from your examples like you are using v2 but it would be good to

[Tutor] super constructor usage

2017-03-29 Thread Rafael Knuth
I am trying to wrap my head around the super constructor. Simple example: class A: def __init__(self): print("world") class B(A): def __init__(self): print("hello") super(B, self).__init__() B() Then I changed the parent class A like this, as I wanted to test