for x in list:
if testof(x):
do_something
do_something
do_something
just as clear as, e.g., Icon's
every x := !list & testof(x) do {
do_something
do_something
do_something
}
The syntactic patterns differ, but neither is really more complex (both
name x twice, both separate list-crawling from predicate testing, both
take a (teensy) bit of thought to understand).
Predicated sequence-crawling is captured best by Guido's 1.0 example:
for x in filter(testof, list): do_something
But then we're apparently in the business of building a temp sequence in
full before the loop begins ...
Unrelatedly, I also like Jaap's "add 'else' to 'try'" idea.
agreeably y'rs - tim
Tim Peters tim@ksr.com
not speaking for Kendall Square Research Corp