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


Groups > comp.lang.python > #82034

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

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <torriem+gmail@torriefamily.org>
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; 'programmer': 0.03; 'subject:Python': 0.06; 'differently.': 0.09; 'skip:> 40': 0.09; 'spaces': 0.09; 'arbitrarily': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'mode,': 0.16; 'skip:> 50': 0.16; 'tab': 0.16; 'tabs': 0.16; 'wrote:': 0.18; 'header:User- Agent:1': 0.23; 'mind.': 0.24; 'least': 0.26; 'header:In-Reply- To:1': 0.27; 'skip:( 20': 0.30; 'code': 0.31; 'that.': 0.31; 'struct': 0.31; 'programmers': 0.33; 'maybe': 0.34; 'could': 0.34; 'display': 0.35; 'knows': 0.35; 'editor': 0.35; 'but': 0.35; 'c++': 0.36; 'skip:> 10': 0.36; 'subject:?': 0.36; 'message- id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'course': 0.61; 'subject: & ': 0.68; 'batchelder': 0.84; 'do:': 0.91
X-Virus-Scanned amavisd-new at torriefamily.org
Date Fri, 05 Dec 2014 20:04:48 -0700
From Michael Torrie <torriem@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11
MIME-Version 1.0
To python-list@python.org
Subject Re: Tabs for indentation & Spaces for alignment in Python 3?
References <CAFaCOgzqxcvuKBrcSkK+DRm-5pHuh6QCXi1PKG4LHGqdBjLF_A@mail.gmail.com> <m5tpqg$iqi$1@ger.gmane.org>
In-Reply-To <m5tpqg$iqi$1@ger.gmane.org>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
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.16650.1417835105.18130.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1417835105 news.xs4all.nl 2920 [2001:888:2000:d::a6]:48999
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82034

Show key headers only | View raw


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;

In fact a decent editor that is auto-indenting code would, at least in C
or C++ mode, do that automatically.

Maybe I misread, but I would think this is what the OP had in mind.
Of course maybe kernel programmers think differently.  Ahh well.



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


Thread

Re: Tabs for indentation & Spaces for alignment in Python 3? Michael Torrie <torriem@gmail.com> - 2014-12-05 20:04 -0700
  Re: Tabs for indentation & Spaces for alignment in Python 3? Marko Rauhamaa <marko@pacujo.net> - 2014-12-06 10:40 +0200
    Re: Tabs for indentation & Spaces for alignment in Python 3? Michael Torrie <torriem@gmail.com> - 2014-12-06 09:41 -0700
      Re: Tabs for indentation & Spaces for alignment in Python 3? Marko Rauhamaa <marko@pacujo.net> - 2014-12-06 18:57 +0200
        Re: Tabs for indentation & Spaces for alignment in Python 3? Michael Torrie <torriem@gmail.com> - 2014-12-06 10:26 -0700
          Re: Tabs for indentation & Spaces for alignment in Python 3? Marko Rauhamaa <marko@pacujo.net> - 2014-12-06 22:04 +0200
    Re: Tabs for indentation & Spaces for alignment in Python 3? Chris Angelico <rosuav@gmail.com> - 2014-12-07 03:46 +1100

csiph-web