alan.gauld at btinternet.com
Sun Aug 29 18:53:43 CEST 2004
On 25 Aug 2004 22:38:06 -0700, rattan at cps.cmich.edu (Ishwar
> def run(program, *args):
> pid = os.fork()
> if not pid:
> os.execvp(program, (program,)+args)
> What is the interpretation of *args (in def run(..)?
> Looks like a reference to me, so, how does one decide when to use
> a reference or not?
Its not a reference its a placeholder for an unspecified number
of arguments. (Actually I think it's technically a tuple of
arguments?) You can think of it like the C va_arg construct
used for functions like printf().
There is also a **args construct which is for a dictionary of
keyword arguments. I'm no expert on these but thats what they are
Here is the url to the documentation:
Author of the Learn to Program website
More information about the Python-list