Terry Reedy, 27.07.2011 04:58:
On 7/26/2011 8:06 PM, llwaeva...@gmail.com wrote:
I have been searching the example on C extension that works in python
3.1.x
All the stdlib modules written in C. These are extension modules that come
with Python. There are perhaps a hundred more on PyPI.
Or hundreds.
337 x C
http://pypi.python.org/pypi?:action=browse&c=181
115 x C++
http://pypi.python.org/pypi?:action=browse&c=183
39 x Cython
http://pypi.python.org/pypi?:action=browse&c=536
And that only includes those that properly state their implementation
language (but I assume that's the large majority).
I also (biasedly) second Dan's recommendation of using Cython instead of C,
as that substantially reduces the chance of producing portability problems
in the first place. It also substantially lowers the barrier of having to
learn much about CPython's C-API and the inner workings and differences of
CPython versions (at least at the C level).
In case the question was about porting existing C code (the OP wasn't clear
here), it's sometimes even faster to rewrite the code (or at least the glue
code) in Cython than to port it to CPython 3.x. And the investment is a
rather good bargain for reducing the future maintenance cost.
Stefan
--
http://mail.python.org/mailman/listinfo/python-list