Variable-length argument list in Python
def foo(*args): print "Number of arguments:", len(args) print "Arguments are: ", args
12361 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
def foo(*args): print "Number of arguments:", len(args) print "Arguments are: ", args
function foo() { $numargs = func_num_args(); echo "Number of arguments: $numargs<br />\n"; if ($numargs >= 2) { echo "Second argument is: " . func_get_arg(1) . "<br />\n"; } $arg_list = func_get_args(); for ($i = 0; $i < $numargs; $i++) { echo "Argument $i is: " . $arg_list[$i] . "<br />\n"; } } foo(1, 2, 3);
>>> def blit(*args, **kw): ... canvas.blit(*args, **kw)