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/2006-March/062113.html below:

[Python-Dev] iterator API in Py3.0

[Python-Dev] iterator API in Py3.0 [Python-Dev] iterator API in Py3.0Michael Hoffman hoffman at ebi.ac.uk
Mon Mar 6 19:47:00 CET 2006
Another nice thing about having a next() built-in is that it makes
getting the first item of a generator expression a lot more elegant,
IMHO.

I think this:

next(item for item in items if item > 3)

is a lot clearer than this:

(item for item in items if item > 3).next()

or alternatives that would break this into multiple statements.

[inspired by a recent python-list question]
-- 
Michael Hoffman <hoffman at ebi.ac.uk>
European Bioinformatics Institute

More information about the Python-Dev mailing list

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