Menu

#5 better indentation for lambda bodies

open
nobody
None
5
2005-05-31
2003-09-26
No

[forwarded from http://bugs.debian.org/208303\]

Currently, if you place the body of a lambda on the
next line (to
curb rightward drift), the Emacs Python mode indents it
like this:

...
lambda x:
body_of_lambda()
...

In keeping with Lisp traditions, and to improve
readability, I suggest
a small amount of indentation for the lambda body, eg:

lambda x:
body_of_lambda()

or

lambda x:
body_of_lambda()

Discussion

  • Skip Montanaro

    Skip Montanaro - 2003-12-19

    Logged In: YES
    user_id=44345

    Matthias, is this still a problem for you? In XEmacs, I get a
    four-space indent if I end the line with "lambda:" and hit the
    TAB key on the next line. (Please check with the latest
    version. It's accumulated several changes in the past day.)

     
  • Skip Montanaro

    Skip Montanaro - 2003-12-19
    • assigned_to: nobody --> montanaro
     
  • Matthias Klose

    Matthias Klose - 2004-03-28

    Logged In: YES
    user_id=60903

    The bug submitter responded in the original report:

    It looks like there's some indentation now, which is
    certainly an
    improvement, but it's relative to the entire statement, so (eg)

    function_with_callback(1, 2, 3, lambda args:
    body_of_the_lambda)

    He prefers:

    function_with_callback(1, 2, 3, lambda args:
    body_of_the_lambda)

    so that the lambda body is visually attached to the lambda.

     
  • Skip Montanaro

    Skip Montanaro - 2005-05-31
    • assigned_to: montanaro --> nobody
     
  • Skip Montanaro

    Skip Montanaro - 2005-05-31

    Logged In: YES
    user_id=44345

    Matthias, I'm sympathetic to your plight, but the code that's responsible
    for computing indentation is already too complex and my lisp-fu isn't
    sufficient for the problem. Unassigning in case some other intrepid
    Lisp cowboy wants to tackle this.

     

Log in to post a comment.