A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-October/129536.html below:

[Python-Dev] Change PEP 399 import recommendation

[Python-Dev] Change PEP 399 import recommendation [Python-Dev] Change PEP 399 import recommendationOscar Benjamin oscar.j.benjamin at gmail.com
Sun Oct 13 18:35:59 CEST 2013
On 12 October 2013 17:55, Christian Heimes <christian at python.org> wrote:
> Am 12.10.2013 17:37, schrieb Nick Coghlan:
>> I think the default recommendation in PEP 399 still makes sense - 2
>> modules are easy to manage than three and the idiom allows for easy
>> partial replacement.
>
> We could ues yet another approach and put the pure Python implementation
> of modules into another directory (e.g. Lib/pystdlib or Lib/purepython).
> This directory is appended to sys.path. Alternative implementations of
> Python or platforms without the necessary bits and pieces would import
> the Python-only version from that directory. C modules can be renamed so
> CPython picks them up in favor of the pure Python modules. No hacks, no
> facade module, no slow down and it's easy to understand, too.
>
> The approach can be used for stat, operator, decimal and perhaps other
> modules, too.

CPython preferentially imports extension modules over .py modules with
the same name. This is what happens when you use Cython in "pure"
mode: You have a pure mod.py file and an "augmenting" mod.pxd that
contains the annotations relevant to Cython. The resulting extension
module is mod.{pyd,so} and is imported by CPython if present. This way
you don't need an additional directory/module.


Oscar
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4