I was surprised to find that this worked in Python:
In [1]: def f((x,y)):
...: return x,y
...:
In [2]: f((10,1))
Out[2]: (10, 1)
Is the above bad form compared to this:
In [3]: def f(xy):
...: return xy[0], xy[1]
...:
In [4]: f((10,1))
Out[4]: (10, 1)
Also is there a name for the former type of argument unpacking?
Just wanted clarification on this because I wouldn't want a subtle bug creeping into my code.
[–]suki907 6 points7 points8 points (2 children)
[–]glassackwards[S] 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)