- Learning Cython Programming(Second Edition)
- Philip Herron
- 238字
- 2021-07-16 09:45:24
Preface
Cython is a tool that makes writing native extensions to Python as easy as writing them in Python. For those who are unaware, you can implement Python modules as pure the C code, which will, for all intents and purposes, look and act like any Python code. This is required when implementing modules in Python, such as the built-in zip module which use native zlib under the hood. Doing this makes sense for the standard library modules part of Python, though for most users of Python, writing native modules should be the last course of action if possible.
Writing native modules is hard and requires prerequisite knowledge of how to use the garbage collector calls correctly in order to avoid memory leaks. It also requires an understanding of how the GIL is used, which changes if you are using CPython or PyPy. It also requires knowledge of the module structures and argument passing internally to the Python runtime. Therefore, it isn't a trivial process when the need arises. Cython lets us write and work with the native code without having to know anything about the Python runtime. We can write almost pure Python code that just so happens to let us manipulate C/C++ types and classes. We can call back and forth from the native code and into the Python code.
More importantly, Cython removes the complexity and intrinsicity and lets the programmer focus on solving problems.
- 程序設(shè)計與實踐(VB.NET)
- 編寫高質(zhì)量代碼:改善Python程序的91個建議
- MATLAB應(yīng)用與實驗教程
- 機器人Python青少年編程開發(fā)實例
- Python爬蟲開發(fā)與項目實戰(zhàn)
- Visual Basic學習手冊
- Visual C++應(yīng)用開發(fā)
- 精通網(wǎng)絡(luò)視頻核心開發(fā)技術(shù)
- 單片機C語言程序設(shè)計實訓100例
- 智能手機故障檢測與維修從入門到精通
- 小程序從0到1:微信全棧工程師一本通
- JavaScript編程精解(原書第2版)
- WCF編程(第2版)
- Unity與C++網(wǎng)絡(luò)游戲開發(fā)實戰(zhàn):基于VR、AI與分布式架構(gòu)
- 語義Web編程