> Thomas Wouters wrote: > I still think > > 'for x in a; y in b:' > > is the right syntax for parallel for loops. It's almost "only" > syntactic sugar for > > 'for x,y in map(None, a, b)' > > but it's fairly straightforward, and in large blocks of code it might > look a lot better. Is there a built-in function in Python to combine sequences elementwise? If I can write: for x,y in pairwise(a, b): foo(x,y) and if the compiler is smart enough to avoid actually constructing the pairwise list, then perhaps new syntax is unnecessary? > Given that you can already do the nested-for-loop with a nested for > loop, and it doesn't suffer (much) in way of readability or pythonity, > I think most people will realize that the parallel for loop does > actually do a parallel for-each. I disagree. That doesn't mean people can't be taught/won't remember that multi-loops are executed in step, rather that by cross product, but I believe most people will guess wrong the first time they see the current notation. Thanks, Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4