Arcane question regarding white space, editors, and code collapsing

Discussion in 'Python' started by Wells, Nov 18, 2009.

  1. Wells

    Wells Guest

    I work in TextMate a lot, which I generally love, but it's code
    collapsing confounds me. Essentially you have to indent blank lines to
    the proper level for the current block. Then it will collapse that
    section as one section. If you have simply a new line, it will see it
    as a break, and not collapse, though the python interpreter doesn't
    care- it only cares about lines of actual code.

    Is it... pythonic, then, to have these lines of tabs/spaces to support
    code collapsing? Is it proper, improper, or irrelevant?

    Thanks.
     
    Wells, Nov 18, 2009
    #1
    1. Advertising

  2. Re: Arcane question regarding white space, editors, and codecollapsing

    On Thu, 19 Nov 2009 10:56:35 +1100, Ben Finney wrote:

    > Wells <> writes:
    >
    >> Is it... pythonic, then, to have these lines of tabs/spaces to support
    >> code collapsing? Is it proper, improper, or irrelevant?

    >
    > It's quite improper (though syntactically null, in Python) to have
    > trailing whitespace on lines. That includes blank lines.


    Blank lines are far from improper in Python, they're recommended by PEP 8.


    > One major reason is that trailing whitespace causes spurious invisible
    > differences between otherwise-identical lines when doing an automatic
    > comparison, which is done quite a lot in collaboration and version
    > control.


    Then you need better comparison software that doesn't give so many false
    matches due to insignificant differences.


    > Fix your text editor (which may entail switching to a better text
    > editor) to respect blank lines and the conventions of the language.


    Yes, if the editor's handling of code collapsing is broken, it needs to
    be fixed, or replaced.


    --
    Steven
     
    Steven D'Aprano, Nov 19, 2009
    #2
    1. Advertising

  3. Wells

    Aahz Guest

    In article <>,
    Ben Finney <> wrote:
    >Wells <> writes:
    >>
    >> Is it... pythonic, then, to have these lines of tabs/spaces to support
    >> code collapsing? Is it proper, improper, or irrelevant?

    >
    >It's quite improper (though syntactically null, in Python) to have
    >trailing whitespace on lines. That includes blank lines.


    Your parenthetical is not quite true, unfortunately. Trailing whitespace
    after a continuation backslash generates a SyntaxError. That's the main
    reason I loathe continuation lines.
    --
    Aahz () <*> http://www.pythoncraft.com/

    The best way to get information on Usenet is not to ask a question, but
    to post the wrong information.
     
    Aahz, Nov 28, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Thompson

    Arcane sts on the MS VM

    Andrew Thompson, Feb 27, 2004, in forum: Java
    Replies:
    2
    Views:
    470
    Andrew Thompson
    Feb 28, 2004
  2. Mark Sapiro
    Replies:
    0
    Views:
    351
    Mark Sapiro
    Jan 8, 2006
  3. Ben C
    Replies:
    6
    Views:
    2,167
    Leif K-Brooks
    Jan 28, 2007
  4. D. Alvarado

    collapsing space between hidden divs

    D. Alvarado, Sep 3, 2004, in forum: Javascript
    Replies:
    1
    Views:
    117
    D. Alvarado
    Sep 4, 2004
  5. DL

    arcane quotes problem again

    DL, May 26, 2008, in forum: Javascript
    Replies:
    8
    Views:
    177
Loading...

Share This Page