Feb-04-2017, 11:46 AM
In general, *args allows a function to accept a variable number of positional parameters, and allows passing of a sequence as different positional parameters:
*args and **kwargs are often used for passing large variable lists through a function or method. The function or method at hand may not care about them, but a function or method it calls will care about them.
def show(*args): print(args[1]) return [args[0]] + args[2:]
def add(a, b): return a + b x = [2, 3] add(*x)There is also **kwargs, which allows similar functionality for dictionaries and variable sets of keyword parameters.
*args and **kwargs are often used for passing large variable lists through a function or method. The function or method at hand may not care about them, but a function or method it calls will care about them.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures