Python编解码器完整系统

2024-04-25 12:32:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在开发一个Python自动完成/代码完成系统。我已经能够用import ast解析我自己的源文件来访问我自己定义的类和函数。你知道吗

现在我想知道,如何访问系统类、函数、常量等的签名。。你知道吗

我怎样才能获得这些信息?python的ast模块也可以吗?你知道吗


Tags: 模块函数代码import信息定义系统ast
1条回答
网友
1楼 · 发布于 2024-04-25 12:32:46

^{}

Get the names and default values of a Python function’s arguments. A tuple of four things is returned: (args, varargs, keywords, defaults). args is a list of the argument names (it may contain nested lists). varargs and keywords are the names of the * and ** arguments or None. defaults is a tuple of default argument values or None if there are no default arguments; if this tuple has n elements, they correspond to the last n elements listed in args.

Changed in version 2.6: Returns a named tupleArgSpec(args, varargs, keywords, defaults).

这只适用于用Python编写的实际函数;其他可调用函数(如类型或内置函数)将不兼容。你知道吗

相关问题 更多 >