Linebreaks and Indention
Martin Schulze
joey at infodrom.org
Wed Mar 24 20:17:55 CET 2004
Bernhard Herzog wrote:
> If I have to split at a "=" (which I try to avoid) I usually do that
> before the =:
>
> foo_bar_baz \
> = bar
Will use this variant.
> 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.
But that would have been soo cool... :)
> > 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.
Unfortunately.
> > 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.
Ah, I see.
> > 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 :)
Oops...
> 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.
Hmm, that doesn't quite fit. How would you like to have the following
construct splitted?
foo = getElementsByName(
getElementByName(getElementByName(getElementByName(
root, 'Capability'), 'Request'), 'GetMap'), 'Format')
It could be done with a *long* root.foo.bar[0].baz[1].gnarz... chain as well.
I don't want to assign four local variables just to keep all
constructs short.
Regards,
Joey
--
Still can't talk about what I can't talk about. Sorry. -- Bruce Schneier
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)