List Comprehension Syntax

Ville Vainio ville at spammers.com
Mon Jul 12 11:06:23 EDT 2004


>>>>> "Peter" == Peter Hansen <peter at engcorp.com> writes:

    Peter> But if you let emacs define the limits of your world, then
    Peter> it's probably okay to do it that way.  ;-)

It's just the path of least resistance - any other indentation
requires manual work, and won't reindent properly when pressing <tab>
on the line.

Anyway, the point is mostly moot because

blah = [
    i + 1
    for i in range(10)
    if i != 3
    ]

indents the way you want it to, and that's the way I usually do it
anyway. I just M-x indent-region'ed your code snippet :).

Perhaps this is something that could be fixed in python-mode.el? I
mean making the indentation on the next line be previous_line + 4 in
bracket-opening situations... Or is the current behaviour better in
some generally agreed way?

-- 
Ville Vainio http://tinyurl.com/2prnb



More information about the Python-list mailing list