Nagarajan wrote:
> 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?
Since you're neither using new-style classes (inheriting from
object) nor multiple inheritance, better use the classic way:
class B(A):
def __init__(self, something):
A.__init__(self)
self.y = something
IMHO, you could also benefit from looking at an OO python tutorial
since this is a standard approach.
Regards,
Björn
--
BOFH excuse #145:
Flat tire on station wagon with tapes. ("Never underestimate the
bandwidth of a station wagon full of tapes hurling down the
highway" Andrew S. Tannenbaum)
--
http://mail.python.org/mailman/listinfo/python-list