[Python-ideas] discouraging direct use of the C-API
Petr Viktorin
encukou at gmail.com
Wed May 6 18:45:05 CEST 2015
On Wed, May 6, 2015 at 6:36 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Eric Snow schrieb am 06.05.2015 um 18:23:
>> 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.
>
> I've been advocating that for years now: leave the low-level stuff to the
> experts. (There's a reason why Cython code is usually faster than C-API code.)
>
> Not sure how big, fat and red the warning needs to be, but a big +1 from me.
Probably not too big. Cython and CFFI are easier to use, so people who
know about them, and can afford the extra dependency*, should use
them. I a pointer would be enough, perhaps like in
https://docs.python.org/3/library/urllib.request.html
* Possibly build-time dependency. Or a complete rewrite, in case of
existing code.
More information about the Python-ideas
mailing list