A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-August/008660.html below:

[Python-Dev] iterators

[Python-Dev] iterators [Python-Dev] iteratorsJack 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 





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4