[Python-Dev] Change PEP 399 import recommendation

Stefan Krah stefan at bytereef.org
Sun Oct 13 13:46:19 CEST 2013


Stefan Behnel <stefan_ml at behnel.de> wrote:
> in a facade module than
> 
>     # lots and lots
>     # of unused
>     # Python code
>     # here ...
> 
>     # ... and then this, well hidden at the end, telling
>     # me that I just waded through the entirely wrong code:
> 
>     try:
>        from _cmodule import *
>     except ImportError:
>        pass

I don't care much about the directory versus facade module approach, but the
above is really worth noting.  For decimal, I find the three-files approach
easier to manage: All private symbols of the Python version are automatically
no longer imported; they don't have to be deleted when the C version is
used.  Also, the new scheme uncovered some missing symbols in __all__.

The downside for CPython is just a slightly more cluttered directory listing
(and the doctests get a bit messier).


The other implementations could import their (hypothetical) accelerators
in the facade module and override selected symbols there (I think Nick
mentioned that already).


Stefan Krah




More information about the Python-Dev mailing list