[Python-Dev] parallel for-loops.

Moshe Zadka Moshe Zadka <moshez@math.huji.ac.il>
Mon, 10 Jul 2000 17:56:56 +0300 (IDT)


On Mon, 10 Jul 2000, Thomas Wouters wrote:

> Here's how it works:
> 
> >>> for x in [1,2,3,4,5]; y in ['a','b','c','d','e','f','g']:
> ...    print x, y
> ...
> 1 a
> 2 b
> 3 c
> 4 d
> 5 e
> >>> 

+1 on the concept anyway 

> If this is deemed undesirable, it would be trivial to add a new bytcode,
> FORMORE_LOOP or such, that handles the multiple-list type of for loop. I
> almost went ahead and did that, but decided I'd try for a patch that
> *doesn't* add bytecodes for a change ;) Unfortunately, the patch is binary
> incompatible, so the bytecode magic does have to be changed.

It's all right, any patch would be binary incompatible

> I'll do some more testing on this, write some docs and some tests, and if
> noone here has convinced me otherwise, upload it to sourceforge ;) The patch
> is really suprisingly small and elegant, thanks to Python's extreme
> simplicity!

Hmmmm... I still think there should be a FOR_MORELOOP, but I think this
specific patch should be uploaded to SF so we can play with this a bit.

--
Moshe Zadka <moshez@math.huji.ac.il>
There is no GOD but Python, and HTTP is its prophet.
http://advogato.org/person/moshez