Classes, Inheritance - Stupid lazy question

Janko Hauser jhauser at ifm.uni-kiel.de
Wed Apr 12 05:55:32 EDT 2000


Michael Hudson <mwh21 at cam.ac.uk> writes:

> Nononono; think about what happens if you do this:
> 
> class bob(paul):
>    pass
> 
> bob("adam").fired()
> 
> What *I* think you want is:
> 
> class paul(lazy):
>     def __init__(self, name):
>         lazy.__init__(self,name)
>         self.april_pay = 0
> 
>     def fired(self):
>         print "Here's a box, collect the things from your desk"
>         lazy.fired(self)
> 
> After all, if you're going to inherit from a class, you must have
> access to it, right?
> 

I see, this is clearly better. But I do not understand, where the
class/instance?? of lazy.__init__() is stored. 

Some more slaps on the head, please :-)

__Janko

-- 
  Institut fuer Meereskunde             phone: 49-431-597 3989
  Dept. Theoretical Oceanography        fax  : 49-431-565876
  Duesternbrooker Weg 20                email: jhauser at ifm.uni-kiel.de
  24105 Kiel, Germany



More information about the Python-list mailing list