[Tutor] subclass / superclass methods

Alan Gauld alan.gauld at blueyonder.co.uk
Thu Jul 1 03:45:38 EDT 2004

> I'm trying to find out why the below does not work as I'm expecting.
> sure there is a good answer, just I'm too green to understand why.
> help would be appreciated. My expected results are for it to say
> other OnTick'

First, its a bad oidea to create a class called object, since that
will hide the builtin class called object which could produce
weird results!

> class object:
>     def __init__(self):
>     def EventTick(self):
>         print 'Hello object EventTick'
>         self.OnTick()
>     def OnTick(self):
> class other(object):
>     def __init__(self):
>     def OnEvent(self):

You have an OnTick() in object but an OnEvent() in other.
I suspect you meant to have an OnTick() in both?

Alan G.

More information about the Tutor mailing list