On 9/10/07, Nagarajan <[EMAIL PROTECTED]> wrote:
>
> 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?
>
You don't need to use super in this case. You just have to remember to
explicitly initialize the classes you are deriving from. In this case,
class B(A):
def __init__(self, something):
A.__init__(self)
self.y = something
bye,
francesco
--
http://mail.python.org/mailman/listinfo/python-list