V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
Deteriorator
V2EX  ›  Python

请问 Python 内置函数 help()的 C 代码在哪里?

  •  
  •   Deteriorator · 2020-06-24 17:26:51 +08:00 · 2023 次点击
    这是一个创建于 1395 天前的主题,其中的信息可能已经有所发展或是发生改变。
    如题,内置函数一般在 cpython 源码中的 bltinmodule.c 文件中,为啥找不到 help()这个内置函数的源代码?请问其到底在哪里?
    4 条回复    2020-06-24 21:00:23 +08:00
    ttvast
        1
    ttvast  
       2020-06-24 17:40:47 +08:00   ❤️ 1
    site.py 里面
    Deteriorator
        2
    Deteriorator  
    OP
       2020-06-24 18:03:46 +08:00
    @ttvast 多谢,最终调用的是 pydoc 中的 help,竟然不是 C 编写的
    Vegetable
        3
    Vegetable  
       2020-06-24 18:08:38 +08:00
    File: /usr/lib/python3.6/_sitebuiltins.py
    sarvatathagata
        4
    sarvatathagata  
       2020-06-24 21:00:23 +08:00   ❤️ 1
    如果你用的是 ipython 的话,输入 help??就可以看到 help 源码的位置和具体实现了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   943 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 20:22 · PVG 04:22 · LAX 13:22 · JFK 16:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.