Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Tabs/spaces for indentation (was Re: re.search when used within anif/else fails)

Reply
Thread Tools

Tabs/spaces for indentation (was Re: re.search when used within anif/else fails)

 
 
Chris Angelico
Guest
Posts: n/a
 
      11-28-2012
On Thu, Nov 29, 2012 at 8:39 AM, Steven D'Aprano
<steve+> wrote:
> Perhaps it would be nice if Python honoured a directive setting indent
> style to spaces or indents, as it honours source code encoding lines:
>
> # -*- indent: <mode> -*-
>
> Where <mode> could be one of:
>
> space[s] Only accept spaces in indentation
> tab[s] Only accept tabs in indentation
> mixed Accept "mixed" tabs and spaces, but only if consistent
>
> with mixed the default for backward compatibility.


I don't know that it needs to be a declaration like that; character
encodings are critical to parsing the file, but
newline-followed-by-tab and newline-followed-by-space are unambiguous.
But it would be of value to have something like that, as editors could
then be configured to respect it - set the editor to turn tab-key into
N spaces but only if "indent tab" is not set, for instance. The
question is, is it worth it? The main value would be when you're
editing someone else's code.

ChrisA
 
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
remove overall indentation preserving reletive indentation Jesse B. Ruby 2 03-27-2010 07:23 PM
DataList Indentation SJ ASP .Net 2 11-04-2005 12:16 AM
[Fwd: Indentation] jacov Java 0 07-22-2004 03:22 PM
List Indentation Jay HTML 5 04-21-2004 02:49 PM
Unwanted indentation Daan HTML 2 12-09-2003 10:09 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57