Re: passing variable length arguments without unpacking them

Jaap Vermeulen (jaap@sequent.com)
Tue, 26 Jan 1993 18:34:26 -0800

| Your problem is that, in trying to pass the argument list on, you're
| actually passing a tuple instead of the original argument list. The
| built-in function "apply" goes the other direction, making a tuple act as
| if it were an argument list. This solves the problem nicely:

I knew I was overlooking something. Thanks for the solution. I
remembered vaguely that I read something about it in the manuals, but
wasn't willing to reread everything to find it. HINT FOR GUIDO: I did
read the sections about functions in the reference manual and I don't
think it referred to apply() whatsoever (it *did* talk about variable
argument lists).

I was thrown off by the non-intuitive fact that a tuple *will* get
unpacked when assigned to formal arguments directly, i.e.:

>>> def fun1(arg1, arg2):
... pass
...
>>> fun1((1, 2))
>>>

works like a champ. I guess this is for backwards compatibility.

Thanks again,

-Jaap-

--
Jaap Vermeulen					+--------------------------+
						| Sequent Computer Systems |
	Internet : jaap@sequent.com		| Beaverton, Oregon	   |
	Uucp	 : ...uunet!sequent!jaap	+--------------------------+