simplebeginnerquestion(**args)
Alex
alex at somewhere.round.here
Sun Jul 25 16:47:20 EDT 1999
Python 1.5.1 (#1, Jan 31 1999, 18:55:21) [GCC 2.8.1] on irix6
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> def keyword_args_demo(**args): print args
...
>>> keyword_args_demo(first_argument=1,second_argument=2)
{'first_argument': 1, 'second_argument': 2}
>>>
You have to explicitly say what each of the keyword arguments are
called. If you don't want to name each argument, use a single asterix:
>>> def arbitrary_args_demo(*args): print args
... # Note the single asterix
...
>>> arbitrary_args_demo(1,2,3,4)
(1, 2, 3, 4)
Alex.
--
I have tried to write the best I can; sometimes I have good luck and can
write better than I can. --Ernest Hemingway
More information about the Python-list
mailing list