[Python-ideas] copyable iterators, named loops, continue a expression per indentation and a few functional things
Eduardo "EdCrypt" O. Padoan
eopadoan at altavix.com
Mon Dec 25 00:16:23 CET 2006
> Named loops
This is an useful idea. But lets explore it a little.
First, it is not exactly a name, a name is a reference to an object,
it is more like a lable.
> With named loops you could break or continue other than only the inner most loop. I'm not sure about
> a syntax, though.
That is the useful part, and I will show why I think your syntax is
not the best for it.
> for x in X as loop_a:
The 'as' keyword (not a keyword untill 2.6) is used to give a name to
an object. Here, the lable 'loop_a', I think, should not be a name to
Second, it gives the impression that with '... X as loop_a' you are
giving X the name 'loop_a'. It reads that way and it is how 'import
... as ...', 'with ... as ...' works and, in Py3k, how 'except ... as
...' will work. Your syntax is an exception to the 'OBJ as NAME'
pattern, and could be misleading. The problem is, I couldnt think yet
of any better syntax.
Besides, the loop label is very usefull, and could be used in while
too if someone find a better syntax.
Jabber: edcrypt at jabber dot org
GTalk: eduardo dot padoan at gmail dot com
MSN: eopadoan at altavix dot com
More information about the Python-ideas