【发布时间】:2016-11-17 23:04:18
【问题描述】:
本来想看看math.py这个函数是怎么实现的,但是在PyCharm中打开文件发现里面所有的函数都是空的,还有一个简单的pass。例如:
def ceil(x): # real signature unknown; restored from __doc__
"""
ceil(x)
Return the ceiling of x as a float.
This is the smallest integral value >= x.
"""
pass
我猜是因为所使用的函数实际上来自 C 标准库。它是如何工作的?
【问题讨论】:
-
math.py?什么math.py?我不认为 Python 带有这样的文件。math模块在Modules/mathmodule.c中实现,该文件可能不会进入您的 Python 安装。 -
谷歌搜索“Python 真实签名未知”表明这是某种 PyCharm 功能,PyCharm 在骗你。
-
没错,pycharm 告诉我
math.py存在。它是一个包含所有空的数学函数的文件,例如我提出的问题中的ceil。
标签: python pycharm standard-library c-standard-library