Re: super() doesn't get superclass

2007-09-20 Thread OKB (not okblacke)
Steven D'Aprano wrote: > class super(object) > | super(type) -> unbound super object > | super(type, obj) -> bound super object; requires isinstance(obj, > | type) super(type, type2) -> bound super object; requires > | issubclass(type2, type) Typical use to call a cooperative > | superclass m

Re: super() doesn't get superclass

2007-09-20 Thread Michele Simionato
On Sep 20, 4:31 pm, "Marshall T. Vandegrift" <[EMAIL PROTECTED]> wrote: > Michele Simionato <[EMAIL PROTECTED]> writes: > > I am not against mixins (even if I am certainly very much against the > > *abuse* of mixins, such as in Zope 2). What I would advocate (but I > > realize that it will never ha

Re: super() doesn't get superclass

2007-09-20 Thread Marshall T. Vandegrift
Michele Simionato <[EMAIL PROTECTED]> writes: > I am not against mixins (even if I am certainly very much against the > *abuse* of mixins, such as in Zope 2). What I would advocate (but I > realize that it will never happen in Python) is single inheritance + > mixins a la Ruby. Ruby might be a ba

Re: super() doesn't get superclass

2007-09-20 Thread Hrvoje Niksic
Ben Finney <[EMAIL PROTECTED]> writes: >> The definition of superclass is not the issue, the issue is >> "superclass *of which class*"? You expect super(A, self) to iterate >> only over superclasses of A, even when self is an instance of a >> subtype of A. > > Yes. Those are the specific paramete

Re: super() doesn't get superclass

2007-09-19 Thread thebjorn
On Sep 19, 3:41 pm, Michele Simionato <[EMAIL PROTECTED]> wrote: > On Sep 19, 3:22 pm, Sion Arrowsmith <[EMAIL PROTECTED]> > wrote: > > > Ben Finney <[EMAIL PROTECTED]> wrote: > > > > If a function is named 'super' and operates on > > >classes, it's a pretty strong implication that it's about > >

Re: super() doesn't get superclass

2007-09-19 Thread Steven D'Aprano
On Thu, 20 Sep 2007 13:36:41 +1000, Ben Finney wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: > >> On Thu, 20 Sep 2007 12:00:40 +1000, Ben Finney wrote: >> >> > In its latter form, it is worthless to me when I'm looking for "get >> > superclass of A", but its name and parameters and docume

Re: super() doesn't get superclass

2007-09-19 Thread Ben Finney
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Thu, 20 Sep 2007 12:00:40 +1000, Ben Finney wrote: > > > In its latter form, it is worthless to me when I'm looking for > > "get superclass of A", but its name and parameters and > > documentation all lead me very strongly to believe otherwise. >

Re: super() doesn't get superclass

2007-09-19 Thread Steven D'Aprano
On Thu, 20 Sep 2007 12:00:40 +1000, Ben Finney wrote: > In its latter form, it is worthless to me when I'm looking for "get > superclass of A", but its name and parameters and documentation all lead > me very strongly to believe otherwise. Why are you looking for the superclass of A? If it is sp

Re: Mixin classes and single/multiple inheritance (was: super() doesn't get superclass)

2007-09-19 Thread Michele Simionato
On Sep 20, 4:55 am, Ben Finney <[EMAIL PROTECTED]> wrote: > Michele Simionato <[EMAIL PROTECTED]> writes: > > I am not against mixins (even if I am certainly very much against > > the *abuse* of mixins, such as in Zope 2). What I would advocate > > (but I realize that it will never happen in Python

Mixin classes and single/multiple inheritance (was: super() doesn't get superclass)

2007-09-19 Thread Ben Finney
Michele Simionato <[EMAIL PROTECTED]> writes: > I am not against mixins (even if I am certainly very much against > the *abuse* of mixins, such as in Zope 2). What I would advocate > (but I realize that it will never happen in Python) is single > inheritance + mixins a la Ruby. For those unfamili

Re: super() doesn't get superclass

2007-09-19 Thread Michele Simionato
On Sep 19, 8:14 pm, Ed Leafe <[EMAIL PROTECTED]> wrote: > On Sep 19, 2007, at 6:52 AM, Michele Simionato wrote: > > > Well, I am personally *against* multiple inheritance (i.e. IMO it > > gives more troubles than advantages) > > For the sorts of examples that have been used in this thread,

Re: super() doesn't get superclass

2007-09-19 Thread Ben Finney
Scott David Daniels <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > [EMAIL PROTECTED] (Alex Martelli) writes: > > > >> In general, "a superclass of foo" means "a class X such that foo is a > >> sublass of X" > > > > Sure. However, this doesn't equate to the assertion that "next class > > in th

Re: super() doesn't get superclass

2007-09-19 Thread Ben Finney
Scott David Daniels <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > [EMAIL PROTECTED] (Alex Martelli) writes: > > > >> In general, "a superclass of foo" means "a class X such that foo is a > >> sublass of X" > > > > Sure. However, this doesn't equate to the assertion that "next class > > in th

Re: super() doesn't get superclass

2007-09-19 Thread Ben Finney
Scott David Daniels <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > [EMAIL PROTECTED] (Alex Martelli) writes: > > > >> In general, "a superclass of foo" means "a class X such that foo is a > >> sublass of X" > > > > Sure. However, this doesn't equate to the assertion that "next class > > in th

Re: super() doesn't get superclass

2007-09-19 Thread Ben Finney
Hrvoje Niksic <[EMAIL PROTECTED]> writes: > Ben Finney <[EMAIL PROTECTED]> writes: > > > Evan is claiming that "the next class in the MRO _is_ a superclass", > > apparently by his definition or some other that I've not seen. > > The definition of superclass is not the issue, the issue is > "supe

Re: super() doesn't get superclass

2007-09-19 Thread Scott David Daniels
Ben Finney wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > >> In general, "a superclass of foo" means "a class X such that foo is a >> sublass of X" > > Sure. However, this doesn't equate to the assertion that "next class > in the MRO is the superclass", which is what I was responding to. >

Re: super() doesn't get superclass

2007-09-19 Thread Ed Leafe
On Sep 19, 2007, at 6:52 AM, Michele Simionato wrote: > Well, I am personally *against* multiple inheritance (i.e. IMO it > gives more troubles than advantages) For the sorts of examples that have been used in this thread, it isn't MI that's problematic; it's the poor quality of the de

Re: super() doesn't get superclass

2007-09-19 Thread Neil Cerutti
On 2007-09-19, Michele Simionato <[EMAIL PROTECTED]> wrote: > On Sep 19, 3:22 pm, Sion Arrowsmith <[EMAIL PROTECTED]> > wrote: >> Ben Finney <[EMAIL PROTECTED]> wrote: >> >> > If a function is named 'super' and operates on >> >classes, it's a pretty strong implication that it's about >> >superclas

Re: super() doesn't get superclass

2007-09-19 Thread Michele Simionato
On Sep 19, 3:22 pm, Sion Arrowsmith <[EMAIL PROTECTED]> wrote: > Ben Finney <[EMAIL PROTECTED]> wrote: > > > If a function is named 'super' and operates on > >classes, it's a pretty strong implication that it's about > >superclasses. > > But it doesn't (under normal circumstances) operate on class

Re: super() doesn't get superclass

2007-09-19 Thread Sion Arrowsmith
Ben Finney <[EMAIL PROTECTED]> wrote: > If a function is named 'super' and operates on >classes, it's a pretty strong implication that it's about >superclasses. But it doesn't (under normal circumstances) operate on classes. It operates on an *instance*. And what you get back is a (proxy to) a su

Re: super() doesn't get superclass

2007-09-19 Thread Robin Becker
Michele Simionato wrote: ... interesting stuff ommitted super seems to return an object of type super, but I cannot seem to find any documention on this type except for 3.4.2.3 "Super Binding If a is an instance of super, then the binding super(B, obj).m() searches obj.__class__.__mro__ for

Re: super() doesn't get superclass

2007-09-19 Thread Neil Cerutti
On 2007-09-19, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Ben Finney <[EMAIL PROTECTED]> writes: > >> Hrvoje Niksic <[EMAIL PROTECTED]> writes: >> >>> class X(Y): >>> def foo(self): >>> super(X, self).foo() >>> >>> ...there is in fact no guarantee that super() calls a superclass of >>> X. H

Re: super() doesn't get superclass

2007-09-19 Thread Hrvoje Niksic
Michele Simionato <[EMAIL PROTECTED]> writes: > On Sep 19, 1:16 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: >> Your arguments against the superclass term seem to assume that there >> is only a single superclass to a particular class. > > If you say "the" superclass, then you also assume it is uni

Re: super() doesn't get superclass

2007-09-19 Thread Bruno Desthuilliers
Michele Simionato a écrit : > On Sep 19, 12:36 pm, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: > >> The next class in the MRO *is* a superclass of the *instance*. Else it >> wouldn't be in the MRO !-) > > Bruno, there is no such a thing as a superclass in a multiple > inheritance May I disagr

Re: super() doesn't get superclass

2007-09-19 Thread Michele Simionato
On Sep 19, 1:16 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Your arguments against the superclass term seem to assume that there > is only a single superclass to a particular class. If you say "the" superclass, then you also assume it is unique. But the big issue is that the order of the method

Re: super() doesn't get superclass

2007-09-19 Thread Hrvoje Niksic
Michele Simionato <[EMAIL PROTECTED]> writes: > On Sep 19, 12:36 pm, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: > >> The next class in the MRO *is* a superclass of the *instance*. Else it >> wouldn't be in the MRO !-) > > Bruno, there is no such a thing as a superclass in a multiple > inherita

Re: super() doesn't get superclass

2007-09-19 Thread Michele Simionato
On Sep 19, 12:36 pm, Bruno Desthuilliers wrote: > The next class in the MRO *is* a superclass of the *instance*. Else it > wouldn't be in the MRO !-) Bruno, there is no such a thing as a superclass in a multiple inheritance world, and it is a very bad idea to continue to use that terminology. I

Re: super() doesn't get superclass

2007-09-19 Thread Bruno Desthuilliers
Ben Finney a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > >> Ben Finney a écrit : >>> Evan Klitzke <[EMAIL PROTECTED]> writes: On Tue, 2007-09-18 at 14:15 +1000, Ben Finney wrote: > [the 'super' function] doesn't return the superclass, it returns > the next class in the

Re: super() doesn't get superclass

2007-09-19 Thread Hrvoje Niksic
Ben Finney <[EMAIL PROTECTED]> writes: > Evan is claiming that "the next class in the MRO _is_ a superclass", > apparently by his definition or some other that I've not seen. The definition of superclass is not the issue, the issue is "superclass *of which class*"? You expect super(A, self) to i

Re: super() doesn't get superclass

2007-09-19 Thread Hrvoje Niksic
Ben Finney <[EMAIL PROTECTED]> writes: > Hrvoje Niksic <[EMAIL PROTECTED]> writes: > >> class X(Y): >> def foo(self): >> super(X, self).foo() >> >> ...there is in fact no guarantee that super() calls a superclass of >> X. However, it is certainly guaranteed that it will call a superclass >

Re: super() doesn't get superclass

2007-09-18 Thread Paul Rudin
Ben Finney <[EMAIL PROTECTED]> writes: > Possibly the name 'next_in_mro', while ugly, would at least match the > actual behaviour of this function. In common lisp there's (call-next-method ...) -- http://mail.python.org/mailman/listinfo/python-list

Re: super() doesn't get superclass

2007-09-18 Thread Ben Finney
Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > Try to interpret it as: My point exactly. If a function is named 'super' and operates on classes, it's a pretty strong implication that it's about superclasses. Any explanation that begins "Try to interpret it as" and then goes on to explain t

Re: super() doesn't get superclass

2007-09-18 Thread Michele Simionato
On Sep 18, 12:15 am, Ben Finney <[EMAIL PROTECTED]> wrote: > Howdy all, > > After banging my head against super() trying to reliably get > attributes of a superclass, I gained a little enlightenment when this > turned up in a search: > > "Python's Super is nifty, but you can't use it > (Pre

Re: super() doesn't get superclass

2007-09-18 Thread Ben Finney
Hrvoje Niksic <[EMAIL PROTECTED]> writes: > class X(Y): > def foo(self): > super(X, self).foo() > > ...there is in fact no guarantee that super() calls a superclass of > X. However, it is certainly guaranteed that it will call a superclass > of type(self). Not even that. It could call *an

Re: super() doesn't get superclass

2007-09-18 Thread Ben Finney
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > Ben Finney a écrit : > > Evan Klitzke <[EMAIL PROTECTED]> writes: > >> On Tue, 2007-09-18 at 14:15 +1000, Ben Finney wrote: > >>> [the 'super' function] doesn't return the superclass, it returns > >>> the next class in the MRO, whether that's a sup

Re: super() doesn't get superclass

2007-09-18 Thread Hrvoje Niksic
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > If a class X is in the MRO of call Y, then X is a superclass of Y. I > agree that the documentation for super is somewhat misleading (and > obviously wrong), but it still *give access to* (at least one of) > the superclass(es). I believe the confu

Re: super() doesn't get superclass

2007-09-18 Thread Bruno Desthuilliers
Ben Finney a écrit : > Evan Klitzke <[EMAIL PROTECTED]> writes: > >> On Tue, 2007-09-18 at 14:15 +1000, Ben Finney wrote: >>> Why does the documentation of 'super' say that it returns the >>> superclass when *that's not true*? It doesn't return the >>> superclass, it returns the next class in the

Re: super() doesn't get superclass

2007-09-18 Thread Carl Banks
On Tue, 18 Sep 2007 15:38:46 +1000, Ben Finney wrote: > Evan Klitzke <[EMAIL PROTECTED]> writes: > >> If you're using multiple inheritance, and you're _not_ using super >> everywhere, then your code is broken anyway. > > This seems to support the notion that 'super' is unusable. If I inherit > fr

Re: super() doesn't get superclass

2007-09-17 Thread Ben Finney
Sorry, I read your message too fast and responded to the wrong point :-) [EMAIL PROTECTED] (Alex Martelli) writes: > Ben Finney <[EMAIL PROTECTED]> wrote: > > Am I mistaken in thinking that "superclass of foo" is equivalent > > to "parent class of foo"? If so, I'd lay heavy odds that I'm not > >

Re: super() doesn't get superclass

2007-09-17 Thread Ben Finney
[EMAIL PROTECTED] (Alex Martelli) writes: > In general, "a superclass of foo" means "a class X such that foo is a > sublass of X" Sure. However, this doesn't equate to the assertion that "next class in the MRO is the superclass", which is what I was responding to. -- \ "Even if the voice

Re: super() doesn't get superclass

2007-09-17 Thread Ben Finney
Evan Klitzke <[EMAIL PROTECTED]> writes: > If you're using multiple inheritance, and you're _not_ using super > everywhere, then your code is broken anyway. This seems to support the notion that 'super' is unusable. If I inherit from code that isn't under my control, and then use super(), my code

Re: super() doesn't get superclass

2007-09-17 Thread Alex Martelli
Ben Finney <[EMAIL PROTECTED]> wrote: > Am I mistaken in thinking that "superclass of foo" is equivalent to > "parent class of foo"? If so, I'd lay heavy odds that I'm not alone in > that thinking. "That thinking" (confusing "parent" with "ancestor") makes sense only (if at all) in a single-inher

Re: super() doesn't get superclass

2007-09-17 Thread Ben Finney
Evan Klitzke <[EMAIL PROTECTED]> writes: > On Tue, 2007-09-18 at 14:15 +1000, Ben Finney wrote: > > Why does the documentation of 'super' say that it returns the > > superclass when *that's not true*? It doesn't return the > > superclass, it returns the next class in the MRO, whether that's a > >

Re: super() doesn't get superclass

2007-09-17 Thread Evan Klitzke
On Tue, 2007-09-18 at 14:15 +1000, Ben Finney wrote: > Howdy all, > > After banging my head against super() trying to reliably get > attributes of a superclass, I gained a little enlightenment when this > turned up in a search: > > "Python's Super is nifty, but you can't use it > (Previou

super() doesn't get superclass

2007-09-17 Thread Ben Finney
Howdy all, After banging my head against super() trying to reliably get attributes of a superclass, I gained a little enlightenment when this turned up in a search: "Python's Super is nifty, but you can't use it (Previously: Python's Super Considered Harmful)" http://fuhm.org/super-ha