Calling a function, arguments in a dict ??
Tom Hanks
thanks200 at hotmail.com
Sun Jun 22 23:44:44 EDT 2003
More information about the Python-list mailing list
Sun Jun 22 23:44:44 EDT 2003
- Previous message (by thread): Calling a function, arguments in a dict ??
- Next message (by thread): Calling a function, arguments in a dict ??
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Thomas Weholt" <2002 at weholt.org> wrote in message news:<wYpJa.8525$Hb.148440 at news4.e.nsc.no>... > If I got a dictionary with a bunch of key/values I want to use as named > arguments for a function, how do I do that? > The 'apply' builtin function is designed to handle this. >>> argDict = {'num':10, 'dom':2} >>> def ratio(num, dom): ... return num/dom ... >>> apply(ratio, [], argDict) 5 Tom Hanks.
- Previous message (by thread): Calling a function, arguments in a dict ??
- Next message (by thread): Calling a function, arguments in a dict ??
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list