constructor chaining?

Daniel Ellison daniel at syrinx.net
Tue Jul 24 08:28:50 EDT 2001


"Mark Nenadov" <mnenadov at stclairc.on.ca> wrote in message
news:20010724.081619.1139901474.1751 at d150-169-166.home.cgocable.net...

> I am wondering how I can do constructor chaining with Python.

This is my first post here; I've just started looking into Python and so far
like what I see.  To answer your question, you simply call Media's __init__
constructor from within Book's __init__ constructor:

class Book(Media):
    def __init__(self):
        Media.__init__(self)
        ...

Daniel Ellison
Toronto, Ontario
daniel at syrinx.net






More information about the Python-list mailing list