[XML-SIG] saxlib, xml, _xmlplus, etc.
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Thu, 8 Mar 2001 22:14:36 +0100
Hi Mark,
Thanks for your elaboration of perl versioning mechanics. I agree that
the Python workings appear to be quite similar.
> with my limited python experience i haven't yet seen analogous
> abilities to declare an assumed python core version, or require a
> minimum version from another module.
Sure there is
import sys
assert sys.version_info > (2,0) # requires Python 2.0 or better
In fact, this is how the _xmlplus hack works. xml/__init__ has
_MINIMUM_XMLPLUS_VERSION = (0, 6, 1)
...
v = _xmlplus.version_info
if v >= _MINIMUM_XMLPLUS_VERSION:
import sys
sys.modules[__name__] = _xmlplus
This only installs "_xmlplus" as "xml" if _xmlplus is recent enough.
If you study that code, you'll notice that it also deals with the case
of old PyXML versions, which did not provide version_info.
> but i realize the purpose of this mailing list is not to educate me
> in python :).
It's ok, we are back to your original question.
Regards,
Martin