Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73909

Re: PEP8 and 4 spaces

References <53B59358.2040404@tobiah.org>
Date 2014-07-04 03:38 +1000
Subject Re: PEP8 and 4 spaces
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.11463.1404409116.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Jul 4, 2014 at 3:31 AM, Tobiah <tshepard@rcsreg.com> wrote:
> Coworker takes PEP8 as gospel and uses 4 spaces
> to indent.  I prefer tabs.  Boss want's us to
> unify.

1) PEP 8 is meant to be guidelines, *not* a set of hard-and-fast rules.
2) Tabs let different people display the indents at different widths.
You want it to look like four spaces? No problem. You think it looks
better at eight? Fine, set your display to eight. Easy.
3) Perhaps most importantly: You don't have to unify. Let your source
control system do the work for you. In git, that's the smudge/clean
filters and gitattributes; I don't know the mechanics in hg, but I'm
sure it'll exist; in other systems, you might have to rig something
up, or dig through the docs. But you should be able to settle on one
thing in source control and let everyone check out files in whatever
way they like.

Personally, I like, use, and recommend, tabs - but the next best thing
to tabs is a consistent number of spaces (preferably four). But if you
can't make your tools handle the difference, you're going to be
putting unnecessary strains on the humans. Let the humans work with
whatever they prefer.

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: PEP8 and 4 spaces Chris Angelico <rosuav@gmail.com> - 2014-07-04 03:38 +1000

csiph-web