A proposal has been raised by two CPython core developers to introduce the Rust programming language to CPython. Initially the focus is on allowing Rust to be used for developing optional extension modules for CPython but ultimately their goal is for Rust to become a hard dependency of CPython and used throughout its codebase.
CPython as the reference Python implementation could soon begin allowing Rust code to be used for building new modules while ultimately this proposal looks to let Rust be used throughout CPython:
“We (@emmatyping, @eclips4) propose introducing the Rust programming language to CPython. Rust will initially only be allowed for writing optional extension modules, but eventually will become a required dependency of CPython and allowed to be used throughout the CPython code base.”
The proposal notes the safety benefits of the Rust programming language, other large C/C++ projects like the Linux kernel and Android making use of Rust to improve memory safety, existing CPython issues around invalid memory accesses, and the “zero cost” to Rust and its “excellent” build system. The proposal states:
“In summary, Rust provides many extremely useful benefits that would improve CPython development. Increasing memory safety would be a significant improvement in of itself, but it is far from the only benefit Rust provides.”
It will be interesting to see where this proposal goes for the Python camp.
Those curious about this early proposal for making use of Rust code in CPython can find the initial proposal and early discussion via this Python.org discussion thread.
