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
_______________________________________________
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