[Python-Dev] Change PEP 399 import recommendation

Victor Stinner victor.stinner at gmail.com
Sun Oct 13 21:08:13 CEST 2013


Le 13 oct. 2013 10:19, "Stefan Behnel" <stefan_ml at behnel.de> a écrit :
> I agree. I find it much easier to read a plain and obvious
>
>     try:
>        from _cmodule import *
>     except ImportError:
>        from _pymodule import *
>
> in a facade module ...

I miss maybe something. I don't understand why you would like to use the
Python implementation if a C implementation is available and probably
(much) faster.

Maybe developers of PyPy, IronPython and Jython appreciate our effort to
provide a Python implementation which is up to date and well tested. But
why should we pay a price (bad performance) if the module is not (never?
who uses _pyio?) used in CPython. If another Python uses it, the file can
be renamed (ex: _pyio.py becomes simply io.py).

IMO if the C module is complete (has no extra functions in the "facade"
module), it should get the main name (ex: decimal, not _decimal).

It was discussed to put the Python implementation in anothet directory.
Good idea, but only put the directory in sys.path for unit tests (prepend
it to sys.path to load the Python module).

I am only talking of C module which does not need anything of the "facade"
module.

Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20131013/a666dee1/attachment.html>


More information about the Python-Dev mailing list