xml.sax module documentation

Andrew Dalke dalke at acm.org
Mon Nov 13 09:34:29 EST 2000


Martin von Loewis wrote:
>Thanks for the chance to let me comment on HandlerBase. I think it so
>rarely (if ever) needed that it is not worth defining it. In your
>specific example, all you need is a ContentHandler, so you only need
>to inherit from that class.

What I liked about HandlerBase was that I knew I could call its
constructor.  I don't like that I can't do the following:

class MyHandler(ContentHandler, ErrorHandler):
    def __init__(self):
        ContentHandler.__init__(self)  # this is required
        ErrorHandler.__init__(self)    # but this is an error


because ErrorHandler doesn't have an __init__.  (Just had to fix
all of these over the weekend.)

I started another thread on the topic of having a default __init__
for all classes so that you can always call it.  This gives the
ErrorHandler base class the ability to implement an __init__(self) in
the future and have it work as expected.

                    Andrew
                    dalke at acm.org






More information about the Python-list mailing list