Calling Functions with Variable Argument Objects : Varible length parameter : Function PYTHON TUTORIALS


PYTHON TUTORIALS » Function » Varible length parameter »

 

Calling Functions with Variable Argument Objects


def newfoo(arg1, arg2, *nkw, **kw):
    print 'arg1 is:', arg1
    print 'arg2 is:', arg2
    for eachNKW in nkw:
        print 'additional non-keyword arg:', eachNKW
    for eachKW in kw.keys():
        print "additional keyword arg '%s': %s" (eachKW, kw[eachKW])

newfoo(10203040, foo=50, bar=60)
newfoo(24, *(68), **{'foo': 10'bar': 12})
aTuple = (678)
aDict = {'z'9}
newfoo(123, x=4, y=5, *aTuple, **aDict)



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Function
» Varible length parameter