A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-March/052123.html below:

[Python-Dev] code blocks using 'for' loops and generators

[Python-Dev] code blocks using 'for' loops and generators [Python-Dev] code blocks using 'for' loops and generatorsGreg Ewing greg.ewing at canterbury.ac.nz
Sun Mar 13 07:51:43 CET 2005
Brian Sabbey wrote:
> I prefer re-using the 'for' loop for this purpose because it allows the 
> problem to be solved in a general way by re-using a structure with which 
> most users are already familiar, and uses generators, which are easier 
> to use in this case than defining a class with __exit__, __enter__, etc.

But this is an abuse of both the for-loop and the generator.
It's using a for-loop for something that does not loop and
is never intended to loop, and it's using yield to do
something other than producing a value for consumption.

I'd rather see a new mechanism altogether for this very
different use case.

> -Brian

--
Greg


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