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

Paul Moore p.f.moore at gmail.com
Thu May 7 10:47:15 CEST 2015


On 7 May 2015 at 08:56, M.-A. Lemburg <mal at egenix.com> wrote:
> Aside: The fact that we have so many nice C extensions out
> there is proof that we have a good C API. Even though it is
> not visible to most Python programmers, it forms a significant
> part of Python's success.

Agreed. Maybe a useful exercise for someone thinking about this issue
would be to survey some of the major projects using the C API out
there, and working out what would be involved in switching them to use
cffi or Cython. That would give a good idea of the scale of the issue,
as well as providing some practical help to projects that would be
affected by this sort of recommendation.

Good ones to look at would be:
- lxml
- pywin32

(I refrained from adding scipy and numpy to that list, as that would
make this post seem like a troll attempt, which it isn't, but has
anyone thought of the implications of a recommendation like this on
those projects? OK, they'd probably just ignore it as they have a
genuine need for direct use of the C API, but we would be sending
pretty mixed messages).

I prefer Nick's suggestion of adding better documentation to the
packaging user guide. Maybe even to the extent of having a worked
example. The article at
https://scipy-lectures.github.io/advanced/interfacing_with_c/interfacing_with_c.html
is quite a nice overview, although it's heavily numpy-focused and
doesn't include cffi.

Paul


More information about the Python-ideas mailing list