Non-Indented python

phil hunt philh at comuno.freeserve.co.uk
Thu Nov 22 17:26:13 CET 2001


On 22 Nov 2001 00:25:28 -0500, David Bolen <db3l at fitlinxx.com> wrote:
>Chris Liechti <cliechti at gmx.net> writes:
>
>> tabs are specified as 8 characters. only programmers that use tabs to 
>> indent make them 4 or 3 characters...
>
>Well, you have to be a little careful how you phrase this.  I'm not
>aware of any global document or specification that actually makes a
>pronouncement that tabs are 8 characters

I am aware of one such document. It's called the "Python Reference
Manual":

  First, tabs are replaced (from left to right) by one to eight
  spaces such that the total number of characters up to and
  including the replacement is a multiple of eight (this is
  intended to be the same rule as used by Unix). The total
  number of spaces preceding the first non-blank character then
  determines the line's indentation. Indentation cannot be split
  over multiple physical lines using backslashes; the whitespace
  up to the first backslash determines the indentation.

>> the Java styleguide says that you should use 4 characters indentation and 
>> that you can write a tab for 8 characters, so they made it correct, same as 
>> python has it correct too.
>
>"correct" is too absolute (although personally I agree that using 8 -
>not a fixed 8, but a multiple of 8 - is the most logical choice),
>since tab widths have been "correctly" changeable back to very early
>video displays.

For C there is a program (I think it's called indent) that re-does
the indentation of a source code file according to defined criteria.

Perhaps there should be somertyhing similar for python? When someone
checks code out of CVS it could automatically indent it the way the
user desired, and when checking basck in to CVS, indent it according
to the project standards.

Does anything like this exist?


-- 
*** Philip Hunt *** philh at comuno.freeserve.co.uk ***




More information about the Python-list mailing list