VOOZH about

URL: https://thenewstack.io/cython-offers-the-ease-of-python-the-speed-of-c/

⇱ Cython Offers the Ease of Python, the Speed of C++ - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2023-08-06 08:00:57
Cython Offers the Ease of Python, the Speed of C++
Python

Cython Offers the Ease of Python, the Speed of C++

Cython, a superset of Python, bridges the gap between Python and C or C++. Its aim is to make writing C extensions for Python as easy as Python itself.
Aug 6th, 2023 8:00am by Jessica Wachtel
👁 Featued image for: Cython Offers the Ease of Python, the Speed of C++
Image by Michael Reichelt from Pixabay.

Python is the preferred programming language for working with massive data sets, making it the go-to choice for machine learning, artificial intelligence, and statistical analysis.

But it’s not without flaws, with speed being one of its main weaknesses and another its inability to interact with hardware. C, on the other hand, is faster and can interact with hardware, but has a steep learning curve.

Cython, a superset of Python, bridges the gap between Python and C or C++. Its aim is to make writing C extensions for Python as easy as Python itself. The rationale is that the C extensions can perform much more quickly as stand-alone modules than those run through the Python interpreter.

Cython developers released Cython 3.0 earlier this month with some noteworthy improvements.

This recent blog post written by Mike James did a great job of covering the basics of the latest release of Cython. Cython expanded the use of pure Python mode, strengthened its NumPy compatibility, and made internal updates to enhance future compatibility with Python.

Is Python Getting too Complicated for New Users?
Efforts like the Cython project and the removal of the Global Interpreter Lock aim to gear Python for faster, high-throughput data analysis, but also introduce additional complexity.
No way: The improvements are much needed, backward compatible and optional to use.
0%
Yes: Python’s chief value is its simplicity, not its speed. Production can be executed with R, or C++ or some other performant language.
0%
Who cares? Python is too problematic even for new users (blank spaces, runaway libraries, etc.). Newbies, start with JavaScript instead.
0%
Cowboy Neal (h/t, Slashdot and Jack Kerouac)
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:

The Basics

Cython is an optimizing static compiler for both the Python programming language and the extended Cython programming language (based on Pyrex, a Python-like language for rapidly and easily writing Python extension modules). It provides developers the ability to write Python code that calls to and from C or C++ natively.

By using Cython, developers can turn readable Python code into plain C performance by adding static type declaration. By adding these efficiencies, Cython helps Python interact more efficiently with large data sets. Cython integrates natively with existing code and data from legacy, low-level or high-performance applications and libraries.

Cython 3.0

Recently, version 3 of Cython has been released. The list below is a non-exhaustive highlight of Cython’s new upgrades.

Expanded Pure Python Mode

Historically Cython used its own syntax, a combination of Python and the C-type declaration. This created challenges on its own by limiting the developer’s abilities to troubleshoot and debug with Python tooling as it doesn’t understand Cython’s syntax. As a solution, Cython developers created “pure Python mode.”

Pure Python mode is an alternative syntax that’s fully compatible with Python’s syntax. This meant developers could use their existing linting and code analysis tools on Cython code. The new expanded pure Python mode means the vast majority of Cython functions are now exposed in pure Python mode, including functions for calling external C libraries.

Deeper NumPy Compatibility

NumPy is a widely used Python library that focuses on scientific computing. NumPy creates a multidimensional array object, various derived objects, and an assortment of routines centered around performing quick operations on arrays. Developers can now write NumPy ufuncs directly in Cython. A simple numerical function written in Cython can be quickly and easily applied to the entire contents of a NumPy data structure. Though Cython and NumPy were always compatible, this new feature adds speed and more ease to development.

Internal Changes

Now Cython’s build is more compatible with ongoing updates to Python’s internal changes. Python has a new “limited API” that exposes a guaranteed stable subset of Python’s APIs, specifically for the type of tasks Cython does to hook into the Python interpreter. Cython has the initial, with growing support, for the limited API. This means Cython extensions built for one version of Python will also work in future versions of Python without needing to be recompiled.

Final Thoughts

As someone who doesn’t work with Python often, I find it interesting that this is the third article in as many months that I’ve written about tools that deepen the connection between Python and C. It’s such a marker as to where the industry is going. Data sets get larger and larger, Python remains the go-to, and now these tools are either popping up or getting better to further support the growth.

TRENDING STORIES
Jessica Wachtel is a developer marketing writer at InfluxData where she creates content that helps make the world of time series data more understandable and accessible. Jessica has a background in software development and technical journalism.
Read more from Jessica Wachtel
SHARE THIS STORY
TRENDING STORIES
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.