Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 允许多变量参数列表吗?_Python_Variadic Functions - Fatal编程技术网

Python 允许多变量参数列表吗?

Python 允许多变量参数列表吗?,python,variadic-functions,Python,Variadic Functions,我想知道这种功能是否可行: def func(*arg1, *arg2): 如果是,请告诉我如何识别哪些参数属于arg1,哪些参数属于arg2否,Python中不允许使用这种函数签名: >>> def foo(*args1, *args2): ... SyntaxError: invalid syntax 这是不允许的,因为您已经提到了一个问题:无法确定有多少个参数应该属于*arg1,有多少个参数应该属于*arg2 否,Python中不允许使用这种函数签名: >>

我想知道这种功能是否可行:

def func(*arg1, *arg2):

如果是,请告诉我如何识别哪些参数属于
arg1
,哪些参数属于
arg2

否,Python中不允许使用这种函数签名:

>>> def foo(*args1, *args2):
...
SyntaxError: invalid syntax

这是不允许的,因为您已经提到了一个问题:无法确定有多少个参数应该属于
*arg1
,有多少个参数应该属于
*arg2

否,Python中不允许使用这种函数签名:

>>> def foo(*args1, *args2):
...
SyntaxError: invalid syntax
这是不允许的,因为您已经提到了一个问题:无法确定有多少个参数应该属于
*arg1
,有多少个参数应该属于
*arg2