On 10/7/05, Gustavo Niemeyer <gustavo@niemeyer.net> wrote:
Not sure if this has been proposed before, but one thing I occasionally miss regarding tuple unpack is being able to do:
first, second, *rest = something
Also in for loops:
for first, second, *rest in iterator: pass
This seems to match the current meaning for starred variables in other contexts.
Someone should really write up a PEP -- this was just discussed a week or two ago. I personally think this is adequately handled by writing: (first, second), rest = something[:2], something[2:] I believe that this wish is an example of "hypergeneralization" -- an incorrect generalization based on a misunderstanding of the underlying principle. Argument lists are not tuples [*] and features of argument lists should not be confused with features of tuple unpackings. [*] Proof: f(1) is equivalent to f(1,) even though (1) is an int but (1,) is a tuple. -- --Guido van Rossum (home page: http://www.python.org/~guido/)