Main.DictionaryVarArgs History
Hide minor edits - Show changes to markup
March 23, 2010, at 11:13 PM MST
by -
Added lines 1-30:
(:source lang=python:)
def dictionary_var_args(arg1, arg2 = 'defaultB', **args) :
print 'formal arg1:', arg1
print 'formal arg2:', arg2
print 'the rest:', str(args)
print 'the type of args', type(args)
- you can call it with a single argument:
dictionary_var_args('one')
- or two:
dictionary_var_args('one', 'two')
- note that in the above two calls the dictionary of additional
- arguments is empty
dictionary_var_args('one', 'two')
dictionary_var_args('one', one = 'uno', two = 'dos')
def var_args(*tuple_args, **dict_args) :
print 'tuple args:', str(tuple_args)
print 'dictionary args:', dict_args
var_args('one', 'two', one = 'uno', two = 'dos')
(:sourceend:)
