[Python-ideas] import fallback syntax
Éric Araujo
merwok at netwok.org
Thu Mar 8 20:59:17 CET 2012
Hi,
[Chris Withers]
> This seems particularly relevant with things like argparse, unittest2,
> distutils2, packaging...
argparse has the same name regardless of its location in site-packages
or the standard library. For unittest/unittest2, what we do in
distutils2 is to do the import dance in one place and all other modules
import unittest from distutils2.tests. You can do the same with
lxml.etree/xml.etree.cElementTree/xml.etree.ElementTree.
> I suspect it'll also be relevant where code uses libraries where the
> author has chosen to have differently named packages for Python 2 and 3.
Can you give examples of projects doing that and their reasons?
> It would also be extremely relevant if any of the misguided "provisional
> packages in stdlib" PEPs make it through...
One of them is withdrawn; the other one is still open for feedback,
please share your comments on python-dev.
Regards
More information about the Python-ideas
mailing list