"inherited" keyword in Python?

Alex Martelli aleaxit at yahoo.com
Tue Dec 5 16:19:46 EST 2000


Hi Niki,

> #class C(A,B):
> #...
> 
> class C_help(A,B):
>   pass
> 
> class C(C_help):
>   def foo( self ):
>     C_help.foo( self )
> 
> I would like to have same functionality without writing X_help class
> whenever i need it.

I posted a solution based on just this idea 1 minute ago!-)

The complete version, which should work but I haven't tested:

import new
def super(klass):
    try: return klass._cached_super
    except:
        return klass.__dict__.getdefault(
            new.classobj('super_%s'%klass.__name__,
            klass.__bases__, {})


Alex



__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com




More information about the Python-list mailing list