[Python-ideas] New 3.x restriction in list comprehensions

Nick Coghlan ncoghlan at gmail.com
Sat Sep 18 09:39:11 CEST 2010


On Sat, Sep 18, 2010 at 8:00 AM, Dirkjan Ochtman <dirkjan at ochtman.nl> wrote:
> On Fri, Sep 17, 2010 at 21:44, Raymond Hettinger
> <raymond.hettinger at gmail.com> wrote:
>> My question for the group is whether it would be a good
>> idea to drop the new restriction.
>
> I like the restriction and would actually advocate having it for
> regular for-loops too (though that would be a big no-no, I guess).

Yep, I tend to parenthesise tuples even when it isn't strictly
necessary as well. Even if the parser doesn't care, it makes it a lot
easier for human readers (including myself when I have to go back and
read that code). (I have similar objections to people that rely on
precedence ordering too heavily in complicated expressions - even if
the compiler understands them correctly, many readers won't know the
precedence table off by heart. Judicious use of parentheses turns code
those readers would otherwise have to think about into something which
is obviously correct even at a glance).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list