unary star
David Eppstein
eppstein at ics.uci.edu
Sat May 3 17:01:00 EDT 2003
If f(a, b, *(c, d)) is always equivalent to f(a, b, c, d), then why
isn't (a, b, *(c, d)) always equivalent to (a, b, c, d)?
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?
It's not really strictly necessary since any expression (..., *L) could
be replaced by (...)+list(L) (the list() may be needed since the +
operation can't handle iterators). But the idea of expanding a sequence
in place seems like a powerful one that could be useful in other
contexts (another one: yield *L).
--
David Eppstein http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science
More information about the Python-list
mailing list