Until yesterday I didn't know that I could use tuple parameter unpacking in function definitons:
2.7.5+ (default, Sep 19 2013, 13:48:49) >>> def func((a, (b, c), d), e): ... print a, b, c, d, e ... >>> args = (('a', ('b', 'c'), 'd'), 'e') >>> func(*args) a b c d e >>>
It turns out this feature was removed in Python3:
Python 3.3.2+ (default, Oct 9 2013, 14:50:09) >>> def func((a, (b, c), d), e): File "<stdin>", line 1 def func((a, (b, c), d), e): ^ SyntaxError: invalid syntax >>>
No comments:
Post a Comment