[Python-3000] suggestion: structured assignment
Mike Klaas
mike.klaas at gmail.com
Thu May 29 03:29:54 CEST 2008
On 28-May-08, at 6:23 PM, Daniel Wong wrote:
> Currently, I must do the following instead:
>
> for n, pair in enumerate(list_of_pairs):
> a, b = pair
> ...
>
> <>
> Thoughts?
I find it hard to believe that you have even attempted this, which has
been valid in python for ages:
>>> for x, (a, b) in enumerate([(1,2), (3,4), (5,6)]):
print x, a, b
0 1 2
1 3 4
2 5 6
-Mike
More information about the Python-3000
mailing list