less obvious "super"

Nagarajan naga86 at gmail.com
Mon Sep 10 05:50:30 EDT 2007


Hi group,
I am confused with "super" usage..It seems to be complicated and less
obvious.
Here is what I need to achieve..

class A :
    def __init__( self ):
        self.x  = 0

class B ( A ):
    def __init__( self, something ):
        # Use "super" construct here so that I can "inherit" x of A
        self.y  = something

How should I use "super" so that I could access the variable "x" of A
in B?

Thanks!




More information about the Python-list mailing list