我看了一个来自pyasl模块的函数。
from PyAstronomy import pyasl
import inspect
print(inspect.getsource(pyasl.get_lagrange_1))它显示该函数返回:
return _get_lagrange_123(q, eps, 1-eps, getdlrp)请问如何查看以_开头的函数?
发布于 2022-10-31 13:50:41
因为它有一个领先的_,所以您需要显式导入它,然后检查它。从github看来,_get_lagrange_123是在src/pyasl/asl/aslExt_1/roche.py中定义的,因此您可以使用
from PyAstronomy.pyasl.asl.aslExt_1.roche import _get_lagrange_123
print(inspect.getsource(_get_lagrange_123))虽然我没有这个库PyAstronomy,所以我不能检查它。无论如何,您首先需要找到函数_get_lagrange_123的定义位置,然后显式地从模块导入函数。
https://stackoverflow.com/questions/74263872
复制相似问题