Python lambda does not accept tuple argument [duplicate]

Solution 1:

You are probably running Python 3.x on Windows, and Python 2.x on Linux. The ability to unpack tuple parameters was removed in Python 3: See PEP 3113.

You can manually unpack the tuple instead, which would work on both Python 2.x and 3.x:

foo = lambda xy: (xy[1],xy[0])

Or:

def foo(xy):
    x,y = xy
    return (y,x)