Classes, Inheritance - Stupid lazy question

Just van Rossum just at
Wed Apr 12 07:44:06 EDT 2000

"Michael Hudson" <mwh21 at> wrote in message
> another option is:
> class paul(lazy):
>     super = lazy
>     def __init__(self, name):
>         self.super.__init__(self,name)
>         self.april_pay = 0
>     def fired(self):
>         print "Here's a box, collect the things from your desk"
>         self.super.fired(self)

At 6:18 PM +0800 12-04-2000, Paul Gresham wrote:
>I like this solution a lot, it makes a lot of sense. Thanks Michael.
>I guess somewhere in Python is a defined route back to the super class, on a
>better day I may just dig through the code.

Actually, the above is flawed, too:

class bob(paul):
    super = paul  # possibly needed for *other* method overrides...

b = bob()
b.fired()  # <-- kaboom!

It's really best to call the overridden method explicitly.


More information about the Python-list mailing list