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


Groups > comp.lang.python > #82043

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

Path csiph.com!usenet.pasdenom.info!gegeweb.org!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <simon+python@bleah.co.uk>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'programmer': 0.03; 'subject:Python': 0.06; 'strict': 0.07; 'forcing': 0.09; 'skip:> 40': 0.09; 'spaces': 0.09; 'changes': 0.15; '>on': 0.16; 'exist.': 0.16; 'skip:> 50': 0.16; 'tab': 0.16; 'tabs': 0.16; 'too).': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'bit': 0.19; 'header:User-Agent:1': 0.23; 'stick': 0.24; 'regardless': 0.24; '(or': 0.24; 'header:In- Reply-To:1': 0.27; 'to:2**1': 0.27; 'michael': 0.29; 'skip:( 20': 0.30; 'code': 0.31; 'easier': 0.31; 'that.': 0.31; '(although': 0.31; 'idea,': 0.31; 'struct': 0.31; 'worked': 0.33; 'programmers': 0.33; 'style': 0.33; 'maybe': 0.34; 'could': 0.34; 'display': 0.35; 'december': 0.35; 'knows': 0.35; 'editor': 0.35; 'skip:> 10': 0.36; 'subject:?': 0.36; 'should': 0.36; 'wrong': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'first': 0.61; 'such': 0.63; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'subject: & ': 0.68; 'guides': 0.74; 'batchelder': 0.84; 'do:': 0.91
User-Agent Kaiten Mail
In-Reply-To <54827250.5060907@gmail.com>
References <CAFaCOgzqxcvuKBrcSkK+DRm-5pHuh6QCXi1PKG4LHGqdBjLF_A@mail.gmail.com> <m5tpqg$iqi$1@ger.gmane.org> <54827250.5060907@gmail.com>
MIME-Version 1.0
Content-Transfer-Encoding 8bit
Content-Type text/plain; charset=UTF-8
Subject Re: Tabs for indentation & Spaces for alignment in Python 3?
From Simon Ward <simon+python@bleah.co.uk>
Date Sat, 06 Dec 2014 17:12:29 +0000
To Michael Torrie <torriem@gmail.com>,python-list@python.org
X-Spam-Flag NO
X-Spam-Score -2.9
X-Spam-Level --
X-Spam-Report No, score=-2.9 required=5.0 tests=ALL_TRUSTED, BAYES_00 autolearn=ham version=3.3.2
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.16656.1417886886.18130.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1417886886 news.xs4all.nl 2885 [2001:888:2000:d::a6]:47772
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82043

Show key headers only | View raw



On 6 December 2014 03:04:48 GMT+00:00, Michael Torrie <torriem@gmail.com> wrote:
>On 12/05/2014 07:31 PM, Ned Batchelder wrote:
>> This is a perfect example!  The code (with tabs as >--- and leading 
>> spaces as .) is:
>> 
>>   >-------if (!list_empty(pending))
>>   >------->-------ret = list_first_entry(pending, struct async_entry,
>>   >------->------->------->-------.......domain_list)->cookie;
>> 
>> Now, display it in your editor with tabs set to four spaces:
>> 
>>   >---if (!list_empty(pending))
>>   >--->---ret = list_first_entry(pending, struct async_entry,
>>   >--->--->--->---.......domain_list)->cookie;
>
>However, a conscientious programmer knows that tabs could be
>arbitrarily
>sized, so he would never do that.  Instead he would do:
>
>   >-------if (!list_empty(pending))
>   >------->-------ret = list_first_entry(pending, struct async_entry,
>   >------->-------.......................domain_list)->cookie;
>
>Which under the heretical tab size of 4:
>   >---if (!list_empty(pending))
>   >--->---ret = list_first_entry(pending, struct async_entry,
>   >--->---.......................domain_list)->cookie;

Not every programmer is as conscientious in the first of place, and that's far easier to get wrong than just agreeing to stick to one thing. This is why (often more rigid) style guides (or rather policies) exist. 

Maybe we should sack such programmers regardless of their other abilities instead of forcing all, including the conscientious, programmers to adhere to strict style policies? While I like the idea, I think that a slap on the wrist and a bit of re-indentation/re-alignment is all that is necessary (although I have worked with people who consider pure style changes to be a sin too).

Simon

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


Thread

Re: Tabs for indentation & Spaces for alignment in Python 3? Simon Ward <simon+python@bleah.co.uk> - 2014-12-06 17:12 +0000

csiph-web