Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Arcane question regarding white space, editors, and code collapsing

Reply
Thread Tools

Arcane question regarding white space, editors, and code collapsing

 
 
Wells
Guest
Posts: n/a
 
      11-18-2009
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.
 
Reply With Quote
 
 
 
 
Steven D'Aprano
Guest
Posts: n/a
 
      11-19-2009
On Thu, 19 Nov 2009 10:56:35 +1100, Ben Finney wrote:

> Wells <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
Aahz
Guest
Posts: n/a
 
      11-28-2009
In article <(E-Mail Removed)>,
Ben Finney <(E-Mail Removed)> wrote:
>Wells <(E-Mail Removed)> 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 ((E-Mail Removed)) <*> http://www.pythoncraft.com/

The best way to get information on Usenet is not to ask a question, but
to post the wrong information.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
arcane quotes problem again DL Javascript 8 05-28-2008 03:21 AM
email.Utils.parseaddr() gives arcane result Mark Sapiro Python 0 01-08-2006 06:55 PM
exapnding and collapsing a table cell on mouse over and out PJ6 ASP .Net 2 09-09-2005 07:19 PM
Arcane sts on the MS VM Andrew Thompson Java 2 02-28-2004 01:47 AM
Affects of a PL filter on white balance and white balance (D100) jeff liss Digital Photography 1 09-05-2003 02:07 PM



Advertisments