Menu

#1158 format code does not right-trim docstrings

open
nobody
None
5
2010-06-03
2010-05-20
No

If I turn on the "right trim lines" code-formatting preference, I would expect that all affected lines, including in docstrings, would be right-trimmed. However, it appears that lines in triple-quoted strings will not have the whitespace cleaned.

Discussion

  • Fabio Zadrozny

    Fabio Zadrozny - 2010-06-03

    Actually, that's done on purpose, because triple-quoted strings are actually used as strings, so, trimming those could make the semantic of your program change (as they're not really comments, but actual strings you can use in your code).

    If you really feel this is needed, maybe an option could be added, but note that I don't feel this should be generally recommended.

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2010-06-03
    • status: open --> pending
     
  • Glyph Lefkowitz

    Glyph Lefkowitz - 2010-06-03
    • status: pending --> open
     
  • Glyph Lefkowitz

    Glyph Lefkowitz - 2010-06-03

    If it were easy to edit docstrings without introducing lots of trailing whitespace by accident, I would probably agree with you. However, if I hit "return return" to add a blank line, I've just added a bunch of trailing spaces, unless I go "up-arrow delete delete" after I'm finished editing.

    Perhaps this could be done for *docstrings*, but not for arbitrary triple-quoted strings?

     
  • Chris Beaven

    Chris Beaven - 2010-11-25

    This is the one feature of pydev which frustrates me.

    I concur with glyf's suggestions - that if it was possible to do this for docstrings only that would be great. Otherwise, providing it as an option at least.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.