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


Groups > comp.lang.python > #82022 > unrolled thread

Re: Tabs for indentation & Spaces for alignment in Python 3?

Started byNed Batchelder <ned@nedbatchelder.com>
First post2014-12-05 16:05 -0500
Last post2014-12-05 16:05 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Tabs for indentation & Spaces for alignment in Python 3? Ned Batchelder <ned@nedbatchelder.com> - 2014-12-05 16:05 -0500

#82022 — Re: Tabs for indentation & Spaces for alignment in Python 3?

FromNed Batchelder <ned@nedbatchelder.com>
Date2014-12-05 16:05 -0500
SubjectRe: Tabs for indentation & Spaces for alignment in Python 3?
Message-ID<mailman.16640.1417813554.18130.python-list@python.org>
On 12/5/14 12:40 PM, Aahan Krish wrote:
> I have two general questions regarding Python that I couldn't find any
> good answers for. This is not the often-asked Tabs vs Spaces question,
> so kindly read it in whole.
>
> *Q1.* This is not to debate the decision, but I really wanted to know
> the reason why PEP 8 chose to go with spaces instead of tabs. I read
> that tabs were initially preferred over spaces (esp. Mr. Rossum)? What
> caused the decision that spaces are better?
>
> According to Core Python Programming (Book):
>
>     ...because tabs vary in the number of spaces depending on your
>     system, we recommend not using tabs if there is any hint of
>     cross-platform development.
>
>
> Isn't that a feature of tabs? (i.e. allowing the user to configure the
> size of a tab stop in his editor, which has no affect whatsoever on the
> tab character itself or how it displays in another user's editor.)

But you can't configure the width of tabs in all the places you look at 
code (printing, online repos, diff viewers, etc, etc).

Others have mentioned the awkward nature of over-indented continuation 
lines.

My feeling is that if you are working with others who feel strongly 
enough about differing indent widths that they need to use tabs so they 
can each have their own way, then you probably have bigger collaboration 
issues.

Use four spaces, and be done with it.  Agree with your team members on 
how your code will look, then innovate on the important things.

-- 
Ned Batchelder, http://nedbatchelder.com

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web