Guido van Rossum wrote:

>> Slightly too late for consideration, I did come up with
>> what I believe is a backwards-compatible syntax extension
>> to support this:
>>
>>    for (x in iter1, y in iter2):
>>      ...

[...]
> Based on the feedback so far I think not. There's also the issue that
> 
>   for (x in A, y in B):
> 
> could just as well be meant as a shortcut for
> 
>   for x in A:
>     for y in B:
> 
> The proposed syntax doesn't quite jive with my guts, and the issue of
> "what to do if they are of unequal length" is a good one, which is
> better solved by being explicit and using zip (== izip).
> 
> Finally (maybe this is why it doesn't jive :-) it seems to me that
> separating the variables is *worse* than
> 
>   for x, y in zip(A, B):
> 
> because the latter emphasizes that you get a new x and a new y at the same 
> time.

I agree. A related issue is, when map() is gone, could zip() grow a keyword
argument, say, 'extend' so that

map(None, A, B)

translates to

zip(A, B, extend=None)?

zip(A, B, extend=0) would fill with 0 etc.

Georg



Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to