Four different ways to pass parameters
|
|
def echo(*args, **kwargs): print args, kwargs
print echo(1, 2, a=3, b=4)
pargs = (1, 2) kargs = {'a':3, 'b':4} print apply(echo, pargs, kargs)
print apply(echo, args) # traditional: tuple
print func(*args) # new apply-like syntax
print echo(*pargs, **kargs) # keyword dictionaries too
print echo(0, *pargs, **kargs) # normal, *tuple, **dictionary
|
|
|
|
|
Related Scripts with Example Source Code in same category :
-
-
-
|
|