[Python-3000] List-Comp style for loops?

Guido van Rossum guido at python.org
Sat Apr 8 05:59:37 CEST 2006


On 4/7/06, Crutcher Dunnavant <crutcher at gmail.com> wrote:
> So, for example:
>
>   [ x(i) for i in range(n) if y(i) ]
>
> Could be represented as:
>
>   for i in range(n) if y(i):
>     x(i)

I don't think many Python users will consider that an improvement.
It's really just saving an indent level and a colon.

I really need to write up my list of guidelines for Python 3000
proposals. One of the guidelines will be "no wild ideas"; another "no
gratuitous changes". I declare this proposal to be excluded by at
least one of those... :-)

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list