我想像在python如何指定空列表,空dict和布尔值作为机器人框架关键字的默认值。
def my_function(arg1="my_string", arg2=[], arg3={}, arg4=True):
pass
指定的下面是一个示例关键字定义等效于上面的默认值。我想指定默认值。
*** Keywords ***
My Function
[Arguments] ${ARG1}=my_default_string ${ARG2}= <How to specify empty list) ${ARG3}= <How to specify empty dict) ${ARG4}= <How to specify boolean true)
some statements
some more statements
不要在你的情况下使用mutables('[]'和'{}')作为默认参数。如果你改变它,它会有一个奇怪的副作用。 –