[Zope3-dev] Zope 3 needs pyexpat?
Fred L. Drake, Jr.
fdrake@acm.org
Thu, 8 Aug 2002 13:22:43 -0400
Martijn Faassen writes:
> Okay, good. And I saw you're checking in at least one change to Zope 3
> to use the One True Way. I'll go and adjust Zope 2's ParsedXML to try
> to use this One True Way as well, and someone also needs to fix test.py
I just fixed this in the Zope 2.7 development area as well.
> People have just not been reading the documentation, I guess. :)
I wish I weren't accustomed to that...
> If I update this stuff, what's the difference between what I get from
>
> from xml.parsers import pyexpat
>
> and
>
> from xml.parsers import expat
>
> Is it the same module or are there also differences?
pyexpat and xml.parsers.pyexpat are extension modules. pyexpat is
provided by Python, and xml.parsers.pyexpat is provided by PyXML.
xml.parsers.expat is a Python module that imports whichever is
available, making everything available from the same module regardless
of which installation variant you're using.
> Good. Which I import with from "xml.parsers import expat", but it's called
> pyexpat. Perhaps we should just call it 'expat' and not confuse people by
> referring to 'pyexpat' lest they decide they should try to import that
> (and sometimes this works :).
The name pyexpat is two things: 1) historical baggage, and 2) a good
way for me to refer to the Python bindings when I'm also talking about
the underlying library. (Others can do this as well. ;) "pyexpat" is
the Python binding (not the public API), and "Expat" is the C
library.
> That'll be a tremendous help, however won't completely fix matters if
> people still do things like:
>
> import pyexpat
>
> or
>
> from xml.parsers import pyexpat
Those are programmers errors, and will at least break in a meaningful
way when the module doesn't exist. The difficulty with
xml.parsers.expat is just the usual partial import problem; painful,
but probably not solvable in the general case.
> Thanks for the explanations! Sorry for my expressions of frustration. :)
Don't be sorry, and don't think you're the only one! I'm definately
looking forward to Python 2.3, so we can just expect Expat to be
there.
-Fred
--
Fred L. Drake, Jr. <fdrake at acm.org>
PythonLabs at Zope Corporation