Re: Understanding the MRO with multiple inheritance

2019-03-30 Thread Chris Angelico
On Sat, Mar 30, 2019 at 7:08 PM Arup Rakshit wrote: > > Thanks Chris and Dieter. I think I got it. It seems it follows the __mro__ of > the caller class, not the current class __mro_. That is correct. It is the object that has an MRO, and it's that object's MRO that matters to super. ChrisA --

Re: Understanding the MRO with multiple inheritance

2019-03-30 Thread Arup Rakshit
Thanks Chris and Dieter. I think I got it. It seems it follows the __mro__ of the caller class, not the current class __mro_. if __name__ == '__main__': print('MRO of SortedIntList {}'.format(SortedIntList.__mro__)) print('MRO of IntList {}'.format(IntList.__mro__)) # MRO of SortedIntLi

Re: Understanding the MRO with multiple inheritance

2019-03-29 Thread Arup Rakshit
Hello DL, I am using Python3. Thanks, Arup Rakshit a...@zeit.io > On 30-Mar-2019, at 6:58 AM, DL Neil wrote: > > Arup, > > There is a minefield here. Are you using Python 2 or 3? > > -- > Regards =dn > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.o

Re: Understanding the MRO with multiple inheritance

2019-03-29 Thread dieter
Arup Rakshit writes: > I basically had defined 4 classes. SimpleList be the base class for all the > other 3 classes. SortedList and IntList both being the child of the base > class SimpleList. They have a single inheritance relationship. Now I have the > last class called SortedIntList which h

Re: Understanding the MRO with multiple inheritance

2019-03-29 Thread Chris Angelico
On Fri, Mar 29, 2019 at 11:54 PM Arup Rakshit wrote: > > Now when I call the add method on the SortedIntList class’s instance, I was > expecting super.add() call inside the IntList class add method will dispatch > it to the base class SimpleList. But in reality it doesn’t, it rather > forwards

Re: Understanding the MRO with multiple inheritance

2019-03-29 Thread DL Neil
Arup, There is a minefield here. Are you using Python 2 or 3? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list