推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
yangzh
V2EX  ›  Python

python 调用 c 大家都用啥?

  •  
  •   yangzh · Jun 7, 2015 via iPhone · 6975 views
    This topic created in 4166 days ago, the information mentioned may be changed or developed.
    常见的似乎有 cython ctypes 等。最近发现 pypy 项目组有个 cffi 项目好像比较优雅,但是中文资源非常少。
    7 replies  •  2015-06-13 11:46:45 +08:00
    ruoyu0088
    ruoyu0088
    Jun 7, 2015 via Android
    1
    我都是一起用,先cffi, 比较特殊的用法用ctypes,例如获取全局变量的地址。提速用cython,例如在循环中调用函数。
    baka
    baka
    Jun 7, 2015
    2
    ctypes
    lilydjwg
    lilydjwg
    Jun 7, 2015❤️2
    3
    简单的用 ctypes,复杂的用 cffi 或者 cython 或者 Python C API。

    cffi 不需要太多文档呀。我用过 LuaJIT FFI,那边的经验到 cffi 这边基本可用。
    nabla
    nabla
    Jun 7, 2015
    4
    之前用过SWIG来生成wrapper,感觉还可以
    xxer
    xxer
    Jun 7, 2015
    5
    @baka +1
    mathgl
    mathgl
    Jun 8, 2015
    6
    use cffi first, if need c++ support, use cython.
    zhuangzhuang1988
    zhuangzhuang1988
    Jun 13, 2015
    7
    Boost.Python
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5035 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 05:58 · PVG 13:58 · LAX 21:58 · JFK 00:58
    ♥ Do have faith in what you're doing.