Re: Use case for multiple inheritance (was Re: MRO problems with diamond inheritance?)

2005-05-02 Thread Michele Simionato
AFAIK, the best use case for multiple inheritance is the plugin pattern, when you plug in methods in a class according to a given condition. For instance: if plugin == "PDF": class DocumentGenerator(BaseGenerator, PDFMixin): pass elif plugin == "PS": class DocumentGenerator(BaseGenerator,

Re: MRO problems with diamond inheritance?

2005-05-02 Thread John Perks and Sarah Mount
"Michele Simionato" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > BTW, what it your use case? I have yet to see a single compelling use > case for multiple inheritance, so I am > curious of what your design is. Before I start, I should mention that my workaround I listed previousl

Use case for multiple inheritance (was Re: MRO problems with diamond inheritance?)

2005-05-02 Thread Aahz
In article <[EMAIL PROTECTED]>, Michele Simionato <[EMAIL PROTECTED]> wrote: > >BTW, what it your use case? I have yet to see a single compelling use >case for multiple inheritance, so I am curious of what your design is. Dunno whether you'd call it compelling, but my current company uses multiple

Re: MRO problems with diamond inheritance?

2005-05-02 Thread M.E.Farmer
>Well, writing that book would be a major undertaking that I am not >willing to take any soon ;) Well at least you didn't say NO, so when you DO write the book I will buy a copy. >However, all you are asking for is already in my lectures at ACCU How many people can say ' No book just these lecture

Re: MRO problems with diamond inheritance?

2005-05-02 Thread Michele Simionato
Well, writing that book would be a major undertaking that I am not willing to take any soon ;) However, all you are asking for is already in my lectures at ACCU: http://www.reportlab.org/~andy/accu2005/pyuk2005_simionato_wondersofpython.zip >From the README: """ Generally speaking these lecture

Re: MRO problems with diamond inheritance?

2005-05-02 Thread M.E.Farmer
Michele Simionato wrote: > M.E. Farmer: > > >You would be surprised how many answers you can squeeze out of that > one > >URL. > >That whole page is worth a month of study( for me anyway ). > > One month only? You must be pretty smart, one could easily extract > a book from that page ;) No, I was b

Re: MRO problems with diamond inheritance?

2005-05-02 Thread Michele Simionato
BTW, what it your use case? I have yet to see a single compelling use case for multiple inheritance, so I am curious of what your design is. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: MRO problems with diamond inheritance?

2005-05-02 Thread Michele Simionato
M.E. Farmer: >You would be surprised how many answers you can squeeze out of that one >URL. >That whole page is worth a month of study( for me anyway ). One month only? You must be pretty smart, one could easily extract a book from that page ;) >I am still trying to grasp the 'purpose' of classm

Re: MRO problems with diamond inheritance?

2005-05-02 Thread Michele Simionato
John & Sarah: > Incidentally, is it safe to have an mro() method in a class, > or is this > as reserved as the usual __reserved_words__? Does Python > use mro() (as > opposed to __mro__) internally or anything? .mro() is a metamethod, it is a method of the metaclass, not of the class. So you can o

Re: MRO problems with diamond inheritance?

2005-05-01 Thread Lee Cullens
Michele Simionato: >> M.E.Farmer: > >> Your answer lies somewhere in this page ;) >> http://www.python.org/2.2.2/de­scrintro.html > > Yes, when it refers to > > http://www.python.org/2.3/mro.html > > (section Bad Method Resolution Orders). > > In short, it is a feature, not a bug. I wanted to th

Re: MRO problems with diamond inheritance?

2005-05-01 Thread M.E.Farmer
I knew it was a feature but had only a few minutes to answer and was playing it safe ;) You would be surprised how many answers you can squeeze out of that one URL. That whole page is worth a month of study( for me anyway ). I am still trying to grasp the 'purpose' of classmethods. Michele Simiona

Re: MRO problems with diamond inheritance?

2005-05-01 Thread Michele Simionato
> M.E.Farmer: >Your answer lies somewhere in this page ;) >http://www.python.org/2.2.2/de­scrintro.html Yes, when it refers to http://www.python.org/2.3/mro.html (section Bad Method Resolution Orders). In short, it is a feature, not a bug. Michele Simionato -- http://mai

Re: MRO problems with diamond inheritance?

2005-05-01 Thread Robert Dick
M.E.Farmer: > Your answer lies somewhere in this page ;) > http://www.python.org/2.2.2/descrintro.html > M.E.Farmer delegate.py (use PyPI) may also be useful. -Robert Dick- -- http://mail.python.org/mailman/listinfo/python-list

Re: MRO problems with diamond inheritance?

2005-05-01 Thread M.E.Farmer
Your answer lies somewhere in this page ;) http://www.python.org/2.2.2/descrintro.html M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list

MRO problems with diamond inheritance?

2005-05-01 Thread John Perks and Sarah Mount
Trying to create the "lopsided diamond" inheritance below: >>> class B(object):pass >>> class D1(B):pass >>> class D2(D1):pass >>> class D(D1, D2):pass Traceback (most recent call last): File "", line 1, in ? TypeError: Error when calling the metaclass bases Cannot create a consistent method