[Python-Dev] Multiple inheritance

Guido van Rossum guido@digicool.com
Fri, 04 May 2001 14:36:14 -0400


> On 03 May 2001, Paul F. Dubois said:
> > 1. The simple case, X inherits from Y and in defining foo and bar needs to
> > use Y's version:
> > 
> > class X (Y rename foo as _sfoo,
> >                   bar as _sbar
> >         ):

[Greg Ward]
> Maybe I'm being thick, but don't you get the same effect by doing this:
> 
> class X (Y):
>     _sfoo = Y.foo
>     _sbar = Y.bar
> 
> ...or would the "rename" syntax also hide the "foo" and "bar" names from
> X's effective namespace[1]?  In that case, I guess some special syntax
> is needed.

Paul's point is that the rename thing makes it possible to deprecate
the form Y.foo, which is causing the basic ambiguity here.

> [1] "effective namespace" -- the union of X's class dict with all its
> superclass' dicts; not actually X's namespace, but the set of names you
> can use in X.  I think.  Err, whatever.

Probably irrelevant.

--Guido van Rossum (home page: http://www.python.org/~guido/)