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


Groups > comp.lang.python > #10844

Re: Inconsistencies with tab/space indentation between Cygwin/Win32?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <chris@rebertia.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '2.6.4': 0.07; 'exits': 0.07; 'infinite': 0.07; 'interpreter': 0.07; 'pep': 0.07; 'tab': 0.07; 'python': 0.08; '(it': 0.09; 'assumed': 0.09; 'finishes': 0.09; 'loop.': 0.09; 'parsing': 0.09; 'wed,': 0.12; 'wrote:': 0.15; 'indent': 0.16; 'realised': 0.16; 'subject:between': 0.16; 'win7': 0.16; 'cc:addr:python-list': 0.16; 'pm,': 0.16; 'linux': 0.18; 'aug': 0.19; 'command': 0.19; 'cheers,': 0.19; 'cc:2**0': 0.21; 'loop': 0.22; 'maybe': 0.22; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'here?': 0.23; 'indentation': 0.23; 'received:209.85.213.46': 0.23; 'received:mail- yw0-f46.google.com': 0.23; 'code': 0.24; '(or': 0.25; 'tried': 0.27; 'all,': 0.28; 'message-id:@mail.gmail.com': 0.28; 'problem': 0.29; 'cc:addr:python.org': 0.30; 'style.': 0.30; 'version': 0.30; 'least': 0.31; 'url:library': 0.31; 'subject:?': 0.31; 'source': 0.32; 'chris': 0.32; 'does': 0.32; 'rather': 0.33; 'wanna': 0.35; 'uses': 0.35; 'running': 0.35; 'level.': 0.35; 'subject:/': 0.36; 'url:python': 0.37; 'some': 0.37; 'but': 0.37; 'using': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'url:org': 0.38; 'subject:: ': 0.38; 'created': 0.38; 'run': 0.39; 'should': 0.39; 'files,': 0.39; 'url:docs': 0.39; 'subject:with': 0.39; 'might': 0.39; 'plain': 0.40; 'received:209': 0.40; 'where': 0.40; 'due': 0.66; 'press': 0.72; 'spaces': 0.73; 'expects': 0.84; 'sender:addr:chris': 0.84; 'spaces.': 0.84; 'url:reference': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=UotUUCz2Gih9v1TM4hmC6acJaR0LrrMYaItTzUcEhg8=; b=SRDf/GYZARfGi3KZ0Yz3Mcin1cswaTmxxvxjR5Igw52g+PvLenpoLQCpFGXiyGpCsz peujR/8q9+stYmr/cU5q0wZpH4ybZmk9lX8wG7qHzB6aPubSFIsrMUTfWhsjKA9UHnfX /dADL0mPorNZDfG9vEFNEO9FbwgMkMLn8BaTs=
MIME-Version 1.0
Sender chris@rebertia.com
In-Reply-To <001201cc525e$8f834510$ae89cf30$@com.au>
References <001201cc525e$8f834510$ae89cf30$@com.au>
Date Thu, 4 Aug 2011 00:08:29 -0700
X-Google-Sender-Auth t5CL_k-OOvpVPI3_2QAZ5AVcHMM
Subject Re: Inconsistencies with tab/space indentation between Cygwin/Win32?
From Chris Rebert <clp2@rebertia.com>
To Christian Gelinek <cgelinek@radlogic.com.au>
Content-Type text/plain; charset=UTF-8
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1879.1312441712.1164.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1312441712 news.xs4all.nl 23948 [2001:888:2000:d::a6]:55860
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:10844

Show key headers only | View raw


On Wed, Aug 3, 2011 at 9:25 PM, Christian Gelinek
<cgelinek@radlogic.com.au> wrote:
> Hi all,
>
> I have a problem running some python program using version 2.6.4 (or version
> 2.7.2, I tried both) from the Win7 command line - it never finishes due to
> an infinite loop. The thing is, when I run the same program through Cygwin
> which uses Python version 2.6.5, it exits the loop at some point.
>
> I came to try this after I realised that in some of the sources (it is a
> rather big program using many source files, most of them being created by
> others from a Linux environment), the indentation is mixed tabs/spaces where
> the assumed tab size is 8 spaces.

That's just plain evil.

> Reading on the Python website, a tab size of 8 is default anyway, so I would
> have assumed it should work... does that mean that one tab equals 2
> indents?!? I myself never use tabs to indent Python code but let my editor
> do a tab-to-4-spaces conversion when I press <TAB>.
>
> I find it at least confusing to read that Python expects a tab size of 8 but
> at the same time uses 4 spaces for one indent level. Or maybe I am
> completely on the wron track here?

4-space indents are /recommended/ by PEP 8, but the interpreter does
not require or prefer that style. What the interpreter does when
parsing indentation is rather more complicated; see
http://docs.python.org/reference/lexical_analysis.html#indentation

You might wanna look at tabnanny:
http://docs.python.org/library/tabnanny.html

Cheers,
Chris

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


Thread

Re: Inconsistencies with tab/space indentation between Cygwin/Win32? Chris Rebert <clp2@rebertia.com> - 2011-08-04 00:08 -0700

csiph-web