[英]How to have autocomplete in function parameters with kwargs?
def func1(param_0, **kwargs):
if param_0:
return func2(**kwargs)
else:
return func3()
def func2(param_1 = 1, param_2 = 2):
print("func2", param_1, param_2)
def func3():
print("func3")
If I have a piece of code like this, is that possible to have parameter name autocomplete for param_1
and param_2
when calling func_1
? 如果我有一段这样的代码,在调用
func_1
时是否可以为param_1
和param_2
设置参数名称自动完成? That said, in Jupyter notebook or PyCharm or something similar, do I need to manually type in eg param_1
or I could use tabs for autocompletion? 就是说,在Jupyter笔记本电脑或PyCharm或类似产品中,我是否需要手动输入例如
param_1
或可以使用选项卡进行自动完成?
Yes, you will get the default arguments in the call to func2
if func1
doesn't get them. 是的,如果
func1
没有获得默认参数,您将在对func2
的调用中获得默认参数。
But be aware that of there are more arguments that func2
doesn't have, then you will have an error. 但是请注意,
func2
没有更多的参数,那么您将遇到错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.