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/2009-January/085247.html below:

Add a "while" clause to generator expressions

[Python-Dev] PEP 3142: Add a "while" clause to generator expressions [Python-Dev] PEP 3142: Add a "while" clause to generator expressionsAntoine Pitrou solipsis at pitrou.net
Tue Jan 20 17:56:06 CET 2009
Alexey G. Shpagin <python-3000 <at> udmvt.ru> writes:
> 
> Example will look like
>  g = (n for n in range(100) if n*n < 50 or else_break())

Please don't suggest any hack involving raising StopIteration as part of a
conditional statement in a generator expression. It might work today, but it
might as well break tomorrow as it's only a side-effect of the implementation,
not an official property of the language.

Regards

Antoine.


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