P
Prashant
class Shape(object):
def __init__(self, shapename):
self.shapename = shapename
def update(self):
print "update"
class ColoredShape(Shape):
def __init__(self, color):
Shape.__init__(self, color)
self.color = color
print 1
print 2
print 3
self.update()
User can sub-class 'Shape' and create custom shapes. How ever user must call 'self.update()' as the last argument when ever he is sub-classing 'Shape'.
I would like to know if it's possible to call 'self.update()' automatically after the __init__ of sub-class is done?
Cheers
def __init__(self, shapename):
self.shapename = shapename
def update(self):
print "update"
class ColoredShape(Shape):
def __init__(self, color):
Shape.__init__(self, color)
self.color = color
print 1
print 2
print 3
self.update()
User can sub-class 'Shape' and create custom shapes. How ever user must call 'self.update()' as the last argument when ever he is sub-classing 'Shape'.
I would like to know if it's possible to call 'self.update()' automatically after the __init__ of sub-class is done?
Cheers