[Python-Dev] Multiple inheritance (original) (raw)

Trent Mick trentm@ActiveState.com
Thu, 3 May 2001 12:39:27 -0700


On Thu, May 03, 2001 at 12:05:37PM -0700, Neil Schemenauer wrote:

Jeff Epler wrote: > On Thu, May 03, 2001 at 09:24:40AM -0700, Paul F. Dubois wrote: > > class X (Y rename foo as sfoo, > > bar as sbar > > ): > > Why not let us spell this as: > class X(Y): > from Y import foo as sfoo, bar as sbar > ...

This already has a meaning in Python. Paul's suggested syntax is pretty neat, IMHO.

Ditto but how to you separate the "rename" lists for multiple inheritance?

class X (Y rename foo as _sfoo, bar as _sbar; Z):
    pass
                                            ^---- what to use here

How about:

class X(Y, Z):
    from Y inherit foo as _yfoo, bar as _ybar
    from Z inherit foo as _zfoo, bar as _zbar

Hmmmmm. Don't know if I like that either. Just throwing out ideas.

Trent

-- Trent Mick TrentM@ActiveState.com