[Python-Dev] The `for y in [x]` idiom in comprehensions

Guido van Rossum guido at python.org
Mon Feb 26 19:51:10 EST 2018


On Mon, Feb 26, 2018 at 4:30 PM, Rob Cliffe via Python-Dev <
python-dev at python.org> wrote:


> On 26/02/2018 19:08, Guido van Rossum wrote:
>
> I would like to remind all wannabe language designers that grammar design
> is not just solving puzzles. It's also about keeping the overall feel of
> the language readable. I'm getting the idea that none of the proposals
> discussed so far (whether new syntax or clever use of existing syntax)
> satisfy that constraint. Sometimes a for-loop is just better.
>
> I don't know if you intended these remarks to include my proposal (to
> allow "for VAR = EXPR"), as your message was posted only 27 minutes after
> mine.
> With respect, I honestly feel that this is a relatively small change that
> makes the language *more* readable.
>
> Feel free, one and all, to tell me why I'm wrong.
> Best wishes,
> Rob Cliffe
>

I didn't want to single you out, but yes, I did include your proposal.

The reason is that for people who are not Python experts there's no obvious
reason why `for VAR = EXPR` should mean one thing and `for VAR in EXPR`
should mean another.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180226/3e28e243/attachment.html>


More information about the Python-Dev mailing list