When "deconstructing" a tuple, I can use _
to denote tuple elements I'm not interested in, e.g.
>>> a,_,_ = (1,2,3)
>>> a
1
Using Python 2.x, how can I express the same with function arguments? I tried to use underscores:
>>> def f(a,_,_): return a
...
File "<stdin>", line 1
SyntaxError: duplicate argument '_' in function definition
I also tried to just omit the argument altogether:
>>> def f(a,,): return a
File "<stdin>", line 1
def f(a,,): return a
^
SyntaxError: invalid syntax
Is there another way to achieve the same?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…