Linebreaks and Indention
Bernhard Herzog
bh at intevation.de
Wed Mar 24 19:13:31 CET 2004
Martin Schulze <joey at infodrom.org> writes:
> I noticed that python-mode *and* Python behave "a little bit" strange
> to linebreaks.
>
> If I try to break a longer line inside python-mode
>
> foo_bar_baz = bar
>
> auto-indention creates:
>
> foo_bar_baz = \
> bar
>
> which only saves two characters width, which is rediculous.
If I have to split at a "=" (which I try to avoid) I usually do that
before the =:
foo_bar_baz \
= bar
python-mode doesn't behave all that nicely in that case either but I
usually adjust the indentation of the second line manually. The
behavior of python-mode in this case has annoyed me a bit in the past
but not enough that I've tried to do something about it.
> Do you want the second line indented by 4 characters or zero
> characters? I.e.
>
> foo_bar_baz = \
> bar
>
> or
>
> foo_bar_baz = \
> bar
>
> The latter is created by python-mode/auto-indent if one splits the
> line without inserting a backslash at once.
But reindenting the second line will move it again.
> Surprisingly Python will accept both.
For Python the amount of indentation in the second line doesn't matter
at all as long as the backslash is the last character before the
newline.
> Another question is how you prefer to break long lines with
> function/method calls like
>
> foo_bar_baz(baz_bar
>
> Emacs python-mode/auto-indent automatically indents properly if
> split after an opening paranthesis:
>
> foo_bar_baz(
> baz_bar
>
> but not if split before the parentheis:
>
> foo_bar_baz
> (baz_bar
>
> Surprisingly Python will accept both. But which one do you prefer?
The second one has a different meaning, so it's not acceptable :)
I usually do
foo_bar_baz(some - long - expression,
second argument)
That is, insert line breaks between the arguments. If the argument
expressions are long I'd rather insert the line breaks in the argument
expressions than directly before or after the parenthesis.
Bernhard
--
Intevation GmbH http://intevation.de/
Skencil http://sketch.sourceforge.net/
Thuban http://thuban.intevation.org/
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)