[Python-Dev] iterators
Jack Jansen
jack@oratrix.nl
Tue, 22 Aug 2000 11:45:41 +0200
> it = something.newiterator()
> for x over it:
> if time_to_start_second_loop(): break
> do_something()
> for x over it:
> do_something_else()
Another, similar, paradigm I find myself often using is something like
tmplist = []
for x in origlist:
if x.has_some_property():
tmplist.append(x)
else
do_something()
for x in tmplist:
do_something_else()
I think I'd like it if iterators could do something like
it = origlist.iterator()
for x in it:
if x.has_some_property():
it.pushback()
else
do_something()
for x in it:
do_something_else()
--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm