Skip to content

Instantly share code, notes, and snippets.

@tathagata
Created March 1, 2014 12:15
Show Gist options
  • Save tathagata/9288969 to your computer and use it in GitHub Desktop.
Save tathagata/9288969 to your computer and use it in GitHub Desktop.
var args in python
def square(*l): print map(lamda x:x*x, l)
>>> square(1,2,3)
[1, 4, 9]
>>> square([1,2,3])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 1, in f
File "<stdin>", line 1, in <lambda>
TypeError: can't multiply sequence by non-int of type 'list'
>>> f(1)
[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment