On Fri, May 4, 2018 at 5:34 PM, Thomas Jollans <t...@tjol.eu> wrote:
> On 04/05/18 22:38, Ian Kelly wrote:
>> The real thing is written in C.
>>
>
> Is it though?
>
> https://github.com/python/cpython/blob/a1fc949b5ab8911a803eee691e6eea55cec43eeb/Lib/operator.py#L265

It is. First, notice the docstring of that module says, "This is the
pure Python implementation of the module." Second, notice that near
the bottom of the file is this code:

try:
    from _operator import *
except ImportError:
    pass
else:
    from _operator import __doc__

The implementation actually used by CPython is here:

https://github.com/python/cpython/blob/a1fc949b5ab8911a803eee691e6eea55cec43eeb/Modules/_operator.c#L402

The pure Python version exists to be shared by other Python
implementations that don't support C extensions.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to