[Python-ideas] discouraging direct use of the C-API

Stefan Krah stefan at bytereef.org
Thu May 7 10:54:37 CEST 2015


Eric Snow <ericsnowcurrently at ...> writes:
> A big blocker to making certain sweeping changes to CPython (e.g.
> ref-counting) is compatibility with the vast body of C extension
> modules out there that use the C-API.  While there are certainly
> drastic long-term solutions to that problem, there is one thing we can
> do in the short-term that would at least get the ball rolling.  We can
> put a big red note at the top of every page of the C-API docs that
> encourages folks to either use CFFI or Cython.

-1. CFFI is much slower than using the C-API directly.

Python is a great language by itself, but its excellent C-API is one
of the major selling points.

As for garbage collection vs. refcounting:  I've tried OCaml's C-API
and found it 20% slower than Python's.  Note that OCaml has a fantastic
native code compiler (and the culture is C-friendly), so it seems to
be a hard problem.



Stefan Krah



More information about the Python-ideas mailing list