instance creatiion as an "event"
Arthur
ajsiegel at optonline.net
Tue Apr 22 18:35:58 EDT 2003
Alex writes:
>Not with the once-habitual Python idiom for that purpose. Try it!
>class TestPoint:
> def __init__(self):
> self.tp = 23
> self.redraw()
> def redraw(self):
> print 'TestPoint.redraw', self.tp
>class PointChild(TestPoint):
> def __init__(self):
> self.pc = 42
> TestPoint.__init__(self)
> def redraw(self):
> print 'PointChild.redraw', self.tp, self.pc
>p = PointChild()
Indeed. The behavior I intuitively expected is indeed what one get's and I
was off somewhere in la-la land misundertanding my error messages. Deja vu,
again.
And as it turns out, a little experimentation indicates more thought as to
when in sub's __init__ its parent's __init__ is called might indeed be the
full answer to my issue.
A little simpler than I had hoped ;)
Art
More information about the Python-list
mailing list