>However I don't understand how you can do it without creating *any*
>new objects -- surely two or more loops over the same sequence must be
>possible, so an object holding a pointer to the current item must be
>made. I also think dictionaries should know that one or more
>iterators are active so they can trap modifications to their key set.
Isn't the same true for lists also? The follwing will result in an
endless loop (well, almost, limited by memory):
list = [1,2,3,4]
for l in list:
list.append(5)
What do you have in mind with trapping modifictions? I don't see an
obvious way how to deal with that situation in general, i.e. iterating
over a set of elements while the set is modified.
>Efficiency in Python is a wonderful thing -- your intuition is usually wrong.
I guess than you have to correct the inituitions of us poor python users
from time to time, as you have done with your comment on my original posting. :)
-Toni