Thursday, May 8, 2008

Definitional tuple-packing in Python

Python functions may tuple-pack their arguments.

def foo(a, (b, c)):
print a, b, c

>>> foo(10, (20, 30))
10 20 30

Arguments unpack during evaluation.

No comments: