A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pythoncapi.readthedocs.io/cython.html below:

Cython — pythoncapi 0.1 documentation

Cython

An alternative to using the C API directly is to rewrite a C extension using Cython which generates C code using the C API.

Cython allows you to wrap existing C code, but if you want to use Python objects in C or details which are not exposed at the Python level, you still need the Python C API to work with those.

The code that Cython generates is usually faster than the “obvious” C-API functions, so not using the C-API explicitly in Cython has many advantages, such as not relying on CPython version details, simplifying your code, and speeding it up.

Cython is not just a tool to “wrap existing C code”. That’s only one of its major use cases. Speeding up Python code, and writing C code without writing C code, are just as important.

Whether to use Cython or not depends on your use case. It’s not always the obvious choice (otherwise, those other tools would not exist).

XXX write a better rationale why migrating to Cython!

Questions:

Small practical issue: Cython is not part of the Python 3.7 standard library yet.

See also cffi and Remove the C API.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4