Why Python style guide (PEP-8) says 4 space indents instead of 8 space??? 8 space indents ever ok??

Harry George harry.g.george at boeing.com
Mon Oct 27 03:36:04 EST 2003


Stephen Horne <steve at ninereeds.fsnet.co.uk> writes:

> On Wed, 22 Oct 2003 16:16:15 -0700, Erik Max Francis <max at alcyone.com>
> wrote:
> 
> >Christian Seberino wrote:
> >
> >> I REALLY WANT TO DO MY OPEN SOURCE PYTHON PROJECT
> >> WITH 8 SPACE IDENTS!!!!
> >
> >You don't really think a style guide is going to stop you from doing
> >that, do you?
> 
> Exactly.
> 
> My advice is basically do what suits you. Just do it consistently.
> 
> Personally, I prefer two space indents. I'm just too lazy to type any
> more if I can avoid it. But when editing existing code, in any
> language, I just go with what's already there - as long as there is
> some consistent indentation rule evident, anyway.
> 

If you never work with others, never edit code from others, and never
offer code to the OSS world, then I suppose you can do your own indent
rules.  But for those of us in the connected world (and esp. those
doing XP), playing by the 4-char rule is crucial.

So the question is: How can you do the correct indents everytime,
without having to manually count them out?  You should be using an
editor which understands python indents (e.g., emacs with
python-model.el).  Even vi and nedit can be set up to understand
4-char indents.


> 
> Are there any tools which can intelligently redo the indentation in a
> Python source file? Preferably respecting other formatting conventions
> where practical, though of course I accept that no program could
> replace a programmer with an eye for readability in this respect.
> 


> 
> -- 
> Steve Horne
> 
> steve at ninereeds dot fsnet dot co dot uk

-- 
harry.g.george at boeing.com
6-6M31 Knowledge Management
Phone: (425) 342-5601




More information about the Python-list mailing list