On Sep 26, 8:02 am, "Gabriel Genellina"
wrote:
> If you decide at every invocation which method to call, it's a dispatcher;
> you may use a dictionary to map each alternative to the function to be
> invoked. If it only depends on the type of the argument, there is a hidden
> gem in pkgutil (
On Fri, Sep 25, 2009 at 9:30 PM, Steven D'Aprano
wrote:
> On Fri, 25 Sep 2009 20:15:54 -0700, Chris Rebert wrote:
>
>>> Inside MyClass().method(n), I dispatch to either NClass.method() or
>>> PClass.method() depending on the value of the argument n. The correct
>>> class is called, but then the *o
En Sat, 26 Sep 2009 01:48:08 -0300, Steven D'Aprano
escribió:
I'm aiming for some sort of polymorphic inheritance: in a method, if the
argument meets some condition, inherit from PClass, if it meets another
condition inherit from NClass, and so on. Is there are standard name for
this idea?
Steven D'Aprano writes:
> On Fri, 25 Sep 2009 21:03:09 -0700, Michele Simionato wrote:
> > I usually recommend avoiding multiple inheritance altogether.
>
> In my case, PClass and NClass are actually private classes, and it
> seemed like a nice way to avoid having to fill MyClass with
> slightly-
On Fri, 25 Sep 2009 21:03:09 -0700, Michele Simionato wrote:
> On Sep 26, 4:36 am, Steven D'Aprano cybersource.com.au> wrote:
>> I don't understand why I'm getting the following behaviour when using
>> super() with multiple inheritance.
>
> super is working as intended. If you do not want cooper
On Fri, 25 Sep 2009 20:15:54 -0700, Chris Rebert wrote:
>> Inside MyClass().method(n), I dispatch to either NClass.method() or
>> PClass.method() depending on the value of the argument n. The correct
>> class is called, but then the *other* class method is called as well.
>> E.g. this is what I ex
On Fri, Sep 25, 2009 at 9:36 PM, Steven D'Aprano <
st...@remove-this-cybersource.com.au> wrote:
> I don't understand why I'm getting the following behaviour when using
> super() with multiple inheritance. The following is a minimal example
> demonstrating the behaviour.
>
super() does not have th
On Sep 26, 4:36 am, Steven D'Aprano wrote:
> I don't understand why I'm getting the following behaviour when using
> super() with multiple inheritance.
super is working as intended. If you do not want cooperative methods,
don't use super
and call directly the superclass. I usually recommend avoid
On Fri, Sep 25, 2009 at 7:36 PM, Steven D'Aprano
wrote:
> I don't understand why I'm getting the following behaviour when using
> super() with multiple inheritance. The following is a minimal example
> demonstrating the behaviour.
>
> I have a diamond class hierarchy as follows:
>
> o
> |
> B
>