Re: [Tutor] Inheritance, superclass, ‘super’

2015-07-03 Thread Oscar Benjamin
On 3 July 2015 at 00:47, Ben Finney wrote: >> That depends on what you mean by break it., MI should allow the >> inheriting class to specify which, if any, of its direct superclasses >> methods are invoked. > > That “should” is contrary to Python's collaborative multiple inheritance > model. Inste

Re: [Tutor] Inheritance, superclass, ‘super’

2015-07-02 Thread Ben Finney
Alan Gauld writes: > On 01/07/15 03:48, Ben Finney wrote: > > Alan Gauld writes: > > > >> Whilst I agree with the general use of super I'm not sure what > >> the MRO resolution has to do with this case? > > > > When accessing the superclass, the MRO is always relevant > > Can you explain that? >

Re: [Tutor] Inheritance, superclass, ‘super’

2015-07-02 Thread Ben Finney
Steven D'Aprano writes: > I mostly agree with what Ben says, comments below. > > On Wed, Jul 01, 2015 at 12:48:47PM +1000, Ben Finney wrote: > > So please use `super`, even in single inheritance. Otherwise you are > > restricting the usefulness of your class: it can never be used with > >

Re: [Tutor] Inheritance, superclass, ‘super’

2015-07-02 Thread Steven D'Aprano
On Wed, Jul 01, 2015 at 10:40:20PM +0100, Alan Gauld wrote: > >Multiple inheitance is a fact in Python, and good practice is to not > >arbitrarily write classes that break it. > > That depends on what you mean by break it., MI should allow the > inheriting class to specify which, if any, of its

Re: [Tutor] Inheritance, superclass, ‘super’ (was: __repr__ and __str__)

2015-07-02 Thread Steven D'Aprano
I mostly agree with what Ben says, comments below. On Wed, Jul 01, 2015 at 12:48:47PM +1000, Ben Finney wrote: > Alan Gauld writes: > > > Whilst I agree with the general use of super I'm not sure what > > the MRO resolution has to do with this case? > > When accessing the superclass, the MRO is

Re: [Tutor] Inheritance, superclass, ‘super’

2015-07-01 Thread Alan Gauld
On 01/07/15 03:48, Ben Finney wrote: Alan Gauld writes: Whilst I agree with the general use of super I'm not sure what the MRO resolution has to do with this case? When accessing the superclass, the MRO is always relevant Can you explain that? If I access a class explicitly and call a meth

[Tutor] Inheritance, superclass, ‘super’ (was: __repr__ and __str__)

2015-06-30 Thread Ben Finney
Alan Gauld writes: > Whilst I agree with the general use of super I'm not sure what > the MRO resolution has to do with this case? When accessing the superclass, the MRO is always relevant. > It's explicitly single inheritance and they are explicitly calling the > superclass. They don't know t