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


Groups > comp.lang.python > #82018

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'argument': 0.05; 'subject:Python': 0.06; 'blue': 0.09; 'oh,': 0.09; 'pep': 0.09; 'spaces': 0.09; 'whole.': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'project,': 0.12; 'better?': 0.16; 'decision,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hmm.': 0.16; 'indent': 0.16; 'ought': 0.16; 'personally,': 0.16; 'q1.': 0.16; 'reconfigure': 0.16; 'tabs': 0.16; 'utterly': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'library': 0.18; 'working.': 0.19; 'preferred': 0.22; 'cc:addr:python.org': 0.22; 'stick': 0.24; 'tells': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'am,': 0.29; 'compared': 0.30; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'up.': 0.33; 'guess': 0.33; "i'd": 0.34; 'editor': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'subject:?': 0.36; 'wrong': 0.37; 'two': 0.37; 'initially': 0.38; 'question,': 0.38; 'previous': 0.38; 'little': 0.38; "couldn't": 0.39; 'how': 0.40; 'read': 0.60; 'most': 0.60; 'free': 0.61; 'kindly': 0.61; 'simply': 0.61; "you're": 0.61; "you've": 0.63; 'show': 0.63; 'choose': 0.64; 'between': 0.67; 'debate': 0.68; 'subject: & ': 0.68; 'caused': 0.69; 'eight': 0.74; 'yourself': 0.78; 'krish': 0.84; 'thing,': 0.91; 'to:none': 0.92; 'mr.': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=i2GYT7uJJ1+yVHvu2MHxjHbLnSA5JP9GV3F+v/IP+2U=; b=SBuEsoOFHfho45Fn0z99qi7XOVfcfOLfrJ6/YQzVvAckuOCdHh83UwbMrw7j7PEYPF vox9PTlmrPGU2hloH2Rm5p7LV/TOQUd6G3hwxI3IaG8rLP941JtoNBnJAxOsMSpZ61WL jDzW2bwnoXFfs5d9dTuARHWyzPPC0elzABZkOiS/BjXE5SmAJ4uz+2aZIUKIMutn+TCB +lUPJzyfq5PzHQ2wM6Q2RPh4iuWOHOcMUOM7YtIKgolIb0d6WcODdbD2vfjMloV2u+S5 B6WCJ82GWpw17OurxzMFQ03zjEtss/so1krrQMG9/hmSur/T6TQmZPsWfK7dQ6Fi9kGW 7HmA==
MIME-Version 1.0
X-Received by 10.42.94.14 with SMTP id z14mr9645027icm.59.1417807102230; Fri, 05 Dec 2014 11:18:22 -0800 (PST)
In-Reply-To <CAFaCOgyMf9rQCM1T52VAGB5RRyjEmATS2Cq3A8+KERsT8Pv0bg@mail.gmail.com>
References <CAFaCOgyMf9rQCM1T52VAGB5RRyjEmATS2Cq3A8+KERsT8Pv0bg@mail.gmail.com>
Date Sat, 6 Dec 2014 06:18:22 +1100
Subject Re: Tabs for indentation & Spaces for alignment in Python 3?
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16637.1417807111.18130.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1417807111 news.xs4all.nl 2935 [2001:888:2000:d::a6]:55437
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82018

Show key headers only | View raw


On Sat, Dec 6, 2014 at 4:40 AM, Aahan Krish <krish@aahan.me> 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?

The decisions in PEP 8 govern the Python standard library *only*. For
any other project, you're free to say "We'll follow PEP 8 but using
tabs for indentation" or "We'll follow PEP 8 but use three spaces for
indentation". (Yes, you're free to be utterly insane.)

Personally, I prefer and recommend tabs for indentation. That way, if
there's any argument about how wide indents ought to be, the
belligerents can simply reconfigure them. But ultimately, there's very
little difference between "use tabs" and "use four spaces" and "use
eight spaces" and "use two spaces" (though I'd put them in that
order); the most important thing is to choose *something* and stick
with it.

Oh, and get yourself an editor that tells you when you've mucked them
up. SciTE does; a little blue line fills the indent if it's wrong
compared to the previous one. I work with a lot of students who use
Sublime, have it set to show tabs as four spaces wide, and then have
no idea why their code isn't working. Hmm. I guess "alias
python='python -tt'" would be a good thing, here.

ChrisA

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


Thread

Re: Tabs for indentation & Spaces for alignment in Python 3? Chris Angelico <rosuav@gmail.com> - 2014-12-06 06:18 +1100

csiph-web