allow line break at operators

Chris Angelico rosuav at gmail.com
Mon Aug 15 04:27:47 EDT 2011


On Mon, Aug 15, 2011 at 5:28 AM, Seebs <usenet-nospam at seebs.net> wrote:
> Character stream:  tab tab tab "foo" newline tab "bar".  This is, as you
> say, *usually* two dedents, but it could be one.

I see your point, though I cannot imagine anyone who would use "tab
tab" as an indent level. But if you go from 16 spaces down to 8, it's
possible that the script uses eight space indents, or four.

On Mon, Aug 15, 2011 at 8:31 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> To repeat again: you are free to put in explicit dedent markers that will
> let you re-indent code should all indents be removed.
>

This would be a solution to the above, but it has the feeling of
syntactic salt. (I don't believe that braces are, because they afford
a different form of flexibility.) But sure, if you configure your
editor to do it for you.

I type: if (blah):
It puts:

if (blah):
    |
# << if

with the cursor at the | marker. I never really got used to editors
doing this for me, though. It didn't feel right. I prefer an editor
that deals with my indentation but lets me do the rest; when I hit
enter, it autoindents to either the current indent level or one
greater, depending on whether it "looks like" there ought to be an
indent (which mainly happens when I put a loose { on a line).
Similarly, when I put a } into the file, it removes an indent level
automatically.

Still, it wouldn't be hard to make an editor put those dedent comments
in, if you want them.

ChrisA



More information about the Python-list mailing list