python nested class
Vedanta Barooah
vedanta.barooah at gmail.com
Fri Jul 8 02:26:28 EDT 2005
greetings....
in a python nested class is it possible to change the value of the
parent class's variable without actually creating an instance of the
parent class, consider this code:
class mother:
x=0
def __init__(self):
self.x=1
def show(self):
print self.x
class child:
def increase(self,num):
# mother.increase=num
o = mother()
o.show()
y=mother.child()
y.increase(20)
# this should print 20
o.show()
..... is it possible somehow ???
thanks and regards,
vedanta
More information about the Python-list
mailing list