You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何查看PyAstronomy pyasl模块中以下划线开头的函数?

查看PyAstronomy中以下划线开头的函数源码方法
  • 直接通过模块访问并使用inspect工具查看
    以下划线开头的函数多为模块内部辅助函数,即便属于“私有”命名,只要存在于模块命名空间中,就能用inspect.getsource查看。针对你提到的_get_lagrange_123,可运行以下代码:

    from PyAstronomy import pyasl
    import inspect
    print(inspect.getsource(pyasl._get_lagrange_123))
    

    注:部分下划线开头的函数可能未被加入模块的__all__列表(即不会被from module import *导入),但直接通过模块名._函数名的方式依然能访问到。

  • 直接查看模块源文件
    如果上述方法无法获取源码,可先定位pyasl模块的安装路径:

    from PyAstronomy import pyasl
    print(pyasl.__file__)
    

    得到路径后,用文本编辑器打开对应的.py文件,直接搜索_get_lagrange_123即可找到函数定义。

内容的提问来源于stack exchange,提问作者Elena Greg

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 02:35:19