I want to do something like below:
1. first, second, third, *rest = foo

Python 3.0 has exactly this feature.  No current Python 2.x version has it.

I asked something similar[1] on c.l.p a while back and Diez Roggisch gave this nice workaround/hack[2]

It's a bit ugly in the implementation (sniffing the stack), but elegant in the use, doing exactly what I needed.

It doesn't accommodate the "rest" portion that you reference, but allows for arbitrary unpacking into a fixed-length tuple.

-tkc


[1]
http://mail.python.org/pipermail/python-list/2006-May/381386.html

[2]
http://mail.python.org/pipermail/python-list/2006-May/381399.html




--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to