unary star

"Martin v. Löwis" martin at v.loewis.de
Sat May 3 17:24:56 EDT 2003


David Eppstein wrote:

> That is, since (non-keyworded) function arguments are a lot like tuples, 
> why isn't there a unary star pseudo-operator to expand a sequence into 
> the end of a tuple or list expression?

Because the similarity is shallow: Just look at keyword and optional 
arguments, and you notice quickly that function parameters and tuples 
are entirely different concepts.

That is, in a limited number of cases, you can use tuples to represent 
actual parameters, but that's about it. The *args and **args notations 
are a convience; a shortcut for invoking apply(). A similar shortcut is 
not needed for tuples, and hence it is not (and should not be) supported.

Regards,
Martin





More information about the Python-list mailing list