xml parsing with sax

Alex Martelli aleaxit at yahoo.com
Sun Apr 29 17:38:18 EDT 2001


"Harald Kirsch" <kirschh at lionbioscience.com> wrote in message
news:yv2y9sm469d.fsf at lionsp093.lion-ag.de...
    [snip]
> > Fortunately, the parser just calls .read(N) on its
>
> *That* was the information I was missing. The rest is then more or
> less straighforward, as your example code demonstrates.

This is not a formally documented constraint on the parser (alas,
until and unless interfaces or protocols do get formalized in Python,
we'll have to live with lots of informal mentions of [e.g.] "file-like
objects" that never clarify WHICH file-object methods do need to
be implemented...), but for the current implementation it can be
determined experimentally.  Code inspection on the library sources
AND running a few experiments on an instrumented filelike object
(that delegates all to a file but also prints out what is being called)
to confirm one's understanding gives you that with a few minutes'
investment.


Alex






More information about the Python-list mailing list