
On Mon, Jan 29, 2001 at 09:34:01PM -0500, Eric S. Raymond wrote:
I guess my archetype of the cute C for-loop is the idiom for pointer-list traversal:
struct foo {int data; struct foo *next;} *ptr, *head;
for (ptr = head; *ptr; ptr = ptr->next) do_something_with(ptr->data)
Note two things: in Python, you would use a list, so 'for x i list' does exactly what you want here ;) And if you really need it, you could use iterators for exactly this (once we have them, of course): you are inventing a new storage type. Quite common in C, since the only one it has is useless for anything other than strings<wink>, but not so common in Python.
Not the highest on my list of wants -- I'd sooner have ?: back. I submitted a patch for that once, and the discussion sort of died. Were you dead det against it, or should I revive this proposal?
Triple blech. Guido will never go for it! (There, increased your chance of getting it approved! :) Seriously though, I wouldn't like it much, it's too cryptic a syntax. I notice I use it less and less in C, too. -- Thomas Wouters <thomas@xs4all.net> Hi! I'm a .signature virus! copy me into your .signature file to help me spread!