Re: [Python-Dev] Things to Know About Super

2008-09-02 Thread Nick Coghlan
average wrote: > It seems that the frustration with super revolves around how Python > currently conflates (as well as many users) two very different types > of inheritance, both "is-a" and "has-a" (or compositional) > inheritance. Unfortunately, Python assists this confusion because the > languag

Re: [Python-Dev] Things to Know About Super

2008-09-01 Thread average
It seems that the frustration with super revolves around how Python currently conflates (as well as many users) two very different types of inheritance, both "is-a" and "has-a" (or compositional) inheritance. Unfortunately, Python assists this confusion because the language doesn't provide a disti

Re: [Python-Dev] Things to Know About Super

2008-08-31 Thread Michele Simionato
On Sat, Aug 30, 2008 at 6:16 AM, Michele Simionato > I wrote a trait library which I plan to release soon or later. Ok, just for the people here that cannot wait I have prepared a pre-alpha snapshot and uploaded it to my site: http://www.phyast.pitt.edu/~micheles/python/strait.html At some momen

Re: [Python-Dev] Things to Know About Super

2008-08-29 Thread Michele Simionato
On Fri, Aug 29, 2008 at 8:33 PM, Casey Duncan <[EMAIL PROTECTED]> wrote: > - There are good alternatives to multiple inheritance for many cases, but > there are cases where multiple inheritance is arguably best. Maybe, but I am still biased in the opposite direction ;) >Traits are a > possible al

Re: [Python-Dev] Things to Know About Super

2008-08-29 Thread Raymond Hettinger
From: <[EMAIL PROTECTED]> I think it would benefit everyone if this discussion would end up with some patches to the library documentation that documented the semantics of super() more completely in the reference documentation and the "multiple inheritance" area of the tutorial, so that when pe

Re: [Python-Dev] Things to Know About Super

2008-08-29 Thread glyph
On 06:33 pm, [EMAIL PROTECTED] wrote: On Aug 29, 2008, at 11:46 AM, Michele Simionato wrote: On Fri, Aug 29, 2008 at 6:15 PM, Nick Coghlan <[EMAIL PROTECTED]> wrote: I am very well aware of the collection module and the ABC mechanism. However, you are missing that mixins can be implemented in

Re: [Python-Dev] Things to Know About Super

2008-08-29 Thread Casey Duncan
On Aug 29, 2008, at 11:46 AM, Michele Simionato wrote: On Fri, Aug 29, 2008 at 6:15 PM, Nick Coghlan <[EMAIL PROTECTED]> wrote: The mixin methods in the ABC machinery would be a lot less useful without multiple inheritance (and the collections ABCs would be a whole lot harder to define and

Re: [Python-Dev] Things to Know About Super

2008-08-29 Thread Michele Simionato
On Fri, Aug 29, 2008 at 6:15 PM, Nick Coghlan <[EMAIL PROTECTED]> wrote: > The mixin methods in the ABC machinery would be a lot less useful > without multiple inheritance (and the collections ABCs would be a whole > lot harder to define and to write). > > So if you're looking for use cases for mul

Re: [Python-Dev] Things to Know About Super

2008-08-29 Thread Nick Coghlan
Michele Simionato wrote: > OTOH, for what concerns multiple inheritance, I am still not > convinced it is really worth it. I mean, the MRO is beautiful, > elegant and all that on paper, but on real-life code things as different, > especially from the side of the users of frameworks heavily > based

Re: [Python-Dev] Things to Know About Super

2008-08-28 Thread Michele Simionato
On Fri, Aug 29, 2008 at 6:22 AM, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > You're right, let's abolish inheritance, too, because then you might have to > read more than one class to see what's happening. You are joking, but I actually took this idea quite seriously. Once (four years ago or so) I

Re: [Python-Dev] Things to Know About Super

2008-08-28 Thread Phillip J. Eby
At 06:07 AM 8/29/2008 +0200, Michele Simionato wrote: On Thu, Aug 28, 2008 at 8:54 PM, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > I created a "universal metaclass" in > DecoratorTools whose sole function is to delegate metaclass __new__, > __init__, and __call__ to class-level methods (e.g. __cl

Re: [Python-Dev] Things to Know About Super

2008-08-28 Thread Michele Simionato
On Thu, Aug 28, 2008 at 8:54 PM, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > I created a "universal metaclass" in > DecoratorTools whose sole function is to delegate metaclass __new__, > __init__, and __call__ to class-level methods (e.g. __class_new__, > __class_call__, etc.), thereby eliminating

Re: [Python-Dev] Things to Know About Super

2008-08-28 Thread Terry Reedy
Michele Simionato wrote: Notice that I was discussing an hypothetical language. I was arguing that in principle one could write a different language from Python, with single inheritance only, and not lose much expressivity. I am not advocating any change to current Python. Since this is a li

Re: [Python-Dev] Things to Know About Super

2008-08-28 Thread Phillip J. Eby
At 05:50 PM 8/28/2008 +0200, Michele Simionato wrote: On Aug 28, 5:30 pm, "Phillip J. Eby" <[EMAIL PROTECTED]> wrote: > How is that making things easier for application programmers? We have different definitions of "application programmer". For me a typical application programmer is somebody who

Re: [Python-Dev] Things to Know About Super

2008-08-28 Thread Joel Bender
Greg, Do you have a real-life example of this where multiple inheritance is actually used? I have built a framework that I have called the "capability pattern" which uses multiple inheritance in a way that might be unique (I'm not familiar enough with other frameworks to know for sure). T

Re: [Python-Dev] Things to Know About Super

2008-08-28 Thread Michele Simionato
On Aug 28, 5:30 pm, "Phillip J. Eby" <[EMAIL PROTECTED]> wrote: > How is that making things easier for application programmers? We have different definitions of "application programmer". For me a typical application programmer is somebody who never fiddles with metaclasses, which are the realm of

Re: [Python-Dev] Things to Know About Super

2008-08-28 Thread Phillip J. Eby
At 06:35 AM 8/28/2008 +0200, Michele Simionato wrote: Multiple inheritance of metaclasses is perhaps the strongest use case for multiple inheritance, but is it strong enough? I mean, in real code how many times did I need that? I would not mind make life harder for gurus and simpler for applicati

Re: [Python-Dev] Things to Know About Super

2008-08-27 Thread Michele Simionato
Alex Martelli wrote: > What's DebugFrameworkMeta2? I assume it's some kind of mix but I > don't see it defined anywhere so I'm having to guess. Sorry Alex, here is definition which got lost in cut&paste: DebugFrameworkMeta2 = include_mixin(DebugMeta2, FrameworkMeta2) > I'd like to understand wh

Re: [Python-Dev] Things to Know About Super

2008-08-27 Thread Greg Ewing
M.-A. Lemburg wrote: The typical use is in mixin classes that can be used to add functionality to base classes... But this is just another waffly made-up example. I'm talking about real-life use cases from actual code that's in use. -- Greg ___ Pyth

Re: [Python-Dev] Things to Know About Super

2008-08-27 Thread Michele Simionato
On Wed, Aug 27, 2008 at 4:30 PM, Alex Martelli <[EMAIL PROTECTED]> wrote: > Maybe you could help me understand this by giving a fully executable > Python snippet using __bases__[0] instead of the hypothetical > __base__? Sorry Alex, I have the fully functional snippet but evidently I have sent som

Re: [Python-Dev] Things to Know About Super

2008-08-27 Thread Alex Martelli
On Tue, Aug 26, 2008 at 10:24 PM, Michele Simionato <[EMAIL PROTECTED]> wrote: ... > .. code-block:: python > > def include_mixin(mixin, cls): # could be extended to use more mixins > # traits as in Squeak take the precedence over the base class > dic = vars(mixin).copy() # could be ext

Re: [Python-Dev] Things to Know About Super

2008-08-27 Thread M.-A. Lemburg
On 2008-08-27 09:54, Greg Ewing wrote: > Do you have a real-life example of this where multiple > inheritance is actually used? > > A non-contrived example or two would be a good thing to > have in tutorials etc. where super() is discussed. It > would help to convey the kinds of situations in whic

Re: [Python-Dev] Things to Know About Super

2008-08-27 Thread Greg Ewing
Phillip J. Eby wrote: ISTR pointing out on more than one occasion that a major use case for co-operative super() is in the implementation of metaclasses. The __init__ and __new__ signatures are fixed, multiple inheritance is possible, and co-operativeness is a must Do you have a real-life e

Re: [Python-Dev] Things to Know About Super

2008-08-26 Thread Michele Simionato
On Tue, Aug 26, 2008 at 11:10 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > If you aren't aware of it you should take a look at Enthought's traits > package. It's part of the Enthought Tool Suite (ETS). I know of the existence of that framework, however it is quite large and I don't see the relati

Re: [Python-Dev] Things to Know About Super

2008-08-26 Thread Michele Simionato
On Wed, Aug 27, 2008 at 5:15 AM, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > ISTR pointing out on more than one occasion that a major use case for > co-operative super() is in the implementation of metaclasses. The __init__ > and __new__ signatures are fixed, multiple inheritance is possible, and

Re: [Python-Dev] Things to Know About Super

2008-08-26 Thread Michele Simionato
On Tue, Aug 26, 2008 at 6:13 PM, Michele Simionato <[EMAIL PROTECTED]> wrote: > I not completely against multiple inheritance. I am against multiple > inheritance > as it is now. A restricted form of multiple inheritance in which mixins > classes > are guaranteed to be orthogonal would be fine wi

Re: [Python-Dev] Things to Know About Super

2008-08-26 Thread Michele Simionato
On Wed, Aug 27, 2008 at 3:30 AM, Alex Martelli <[EMAIL PROTECTED]> wrote: > On Tue, Aug 26, 2008 at 6:16 PM, Michele Simionato > <[EMAIL PROTECTED]> wrote: > ... >> It is just a matter of how rare the use cases really are. Cooperative >> methods has been introduced 6+ years ago. In all this time

Re: [Python-Dev] Things to Know About Super

2008-08-26 Thread Phillip J. Eby
At 03:16 AM 8/27/2008 +0200, Michele Simionato wrote: It is just a matter of how rare the use cases really are. Cooperative methods has been introduced 6+ years ago. In all this time surely they must have been used. How many compelling uses of cooperation we can find in real life code? For instan

Re: [Python-Dev] Things to Know About Super

2008-08-26 Thread Alex Martelli
On Tue, Aug 26, 2008 at 6:16 PM, Michele Simionato <[EMAIL PROTECTED]> wrote: ... > It is just a matter of how rare the use cases really are. Cooperative > methods has been introduced 6+ years ago. In all this time surely > they must have been used. How many compelling uses of cooperation > we c

Re: [Python-Dev] Things to Know About Super

2008-08-26 Thread Michele Simionato
On Tue, Aug 26, 2008 at 8:56 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > I would state this differently: "The use cases for cooperative multiple > inheritence don't arise often in practice; so, if we dropped support > for those cases, you probably wouldn't notice until you encountered > one

Re: [Python-Dev] Things to Know About Super

2008-08-26 Thread Steve Holden
Michele Simionato wrote: > On Tue, Aug 26, 2008 at 5:32 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: [...] >> I think it is a non-sequiter to reason from "diamond diagrams are >> complicated" to "mixins should be disallowed". Instead, I think it better >> to simply recommend that a key to happ

Re: [Python-Dev] Things to Know About Super

2008-08-26 Thread Raymond Hettinger
[Raymond] Cooperative multiple inheritance is *not* about mixing two unrelated parents that just happen to use the same method name but have different semantics and were not designed to cooperate with each other. The A-B-C-D diagrams and foo/bar methods in the examples are deceptive because they

Re: [Python-Dev] Things to Know About Super

2008-08-26 Thread Michele Simionato
On Tue, Aug 26, 2008 at 5:32 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > What I would really like to see is a fourth blog entry that shows > how to use super() reliably and correctly. That could be arranged. > In general, I opposed > to creating documentation in the form of "danger, danger

Re: [Python-Dev] Things to Know About Super

2008-08-26 Thread Raymond Hettinger
[Michele Simionato] Recently I have opened a blog on Artima and I am publishing a few Python-related essays I had in store. In particular a trilogy of papers about "super". From the foreword: """ In 2004 I decided to write a comprehensive paper documenting ``super`` pitfalls and traps, ... Th

Re: [Python-Dev] Things to Know About Super

2008-08-24 Thread [EMAIL PROTECTED]
On Aug 24, 3:43 pm, "Matt Giuca" <[EMAIL PROTECTED]> wrote: > Hi Michele, > > Do you have a URL for this blog? > Sorry, here it is: http://www.artima.com/weblogs/index.jsp?blogger=micheles ___ Python-Dev mailing list Python-Dev@python.org http://mail.p

Re: [Python-Dev] Things to Know About Super

2008-08-24 Thread Matt Giuca
Hi Michele, Do you have a URL for this blog? Matt ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

[Python-Dev] Things to Know About Super

2008-08-24 Thread [EMAIL PROTECTED]
Recently I have opened a blog on Artima and I am publishing a few Python-related essays I had in store. In particular a trilogy of papers about "super". From the foreword: """ In 2004 I decided to write a comprehensive paper documenting ``super`` pitfalls and traps, with the goal of publishing it