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 <[EMAIL PROTECTED]>
European Bioinformatics Institute

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to