Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'level,': 0.07; 'exception.': 0.09; 'impose': 0.09; 'lead,': 0.09; 'spaces': 0.09; 'things,': 0.09; 'unittest': 0.09; 'python': 0.11; 'def': 0.12; 'col': 0.16; 'indent': 0.16; 'of)': 0.16; 'tab': 0.16; 'tabs': 0.16; 'to:name:python list': 0.16; '\xa0you': 0.16; 'sat,': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'starts': 0.20; 'import': 0.22; 'email addr:gmail.com>': 0.22; '(or': 0.24; 'options': 0.25; 'script': 0.25; '>': 0.26; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'am,': 0.29; "doesn't": 0.30; 'mix': 0.30; 'skip:& 60': 0.30; 'statement': 0.30; 'especially': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'lines': 0.31; 'indentation': 0.31; 'writes:': 0.31; 'file': 0.32; 'class': 0.32; 'subject:all': 0.32; 'run': 0.32; 'url:python': 0.33; 'level.': 0.33; "i'd": 0.34; "can't": 0.35; 'skip:s 30': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'next': 0.36; 'url:org': 0.36; 'should': 0.36; 'so,': 0.37; 'level': 0.37; 'starting': 0.37; 'being': 0.38; 'others.': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'skip:& 20': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'free': 0.61; 'john': 0.61; 'simple': 0.61; 'first': 0.61; "you'll": 0.62; 'email addr:gmail.com': 0.63; 'kind': 0.63; 'soon': 0.63; 'map': 0.64; 'more': 0.64; 'subject:you': 0.87; 'luck': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=iPrx+2tx6FkA+3c9u6Av+3caqVnsgFEr9WjrW9Ut9ug=; b=DCxGNXmIMoDomHrRA1PUyKGyDQ1nKA+1tKshi62dGKrkTcE7VdhAFDqUJlxrOuSajA Ivo8IXatO5/iOTj3STBjXXF+Yn8R8Pd5vJHJgap8+hbReveDhgVuH3T1tSX4/G5aAVy+ s3p9aoZ8MAxlLHuUMcAs4pW9fzR8jIZJ99Afo7i/2mnWhvnXTk/g+001sxDaxN/MbNsn jwPud2XSe9ZptnNFgrLUW8MzoilKOaUbcB4gv7IM8D3qicdex7qlepWMBsAdd64V+Jag TJca+hs3pma7xkgAp6DbsPiuAqMxwSwCeGK3RPdM5sPvzkMCnV6Q9vp3Oy7cePAWHHKN Q4/Q== MIME-Version: 1.0 X-Received: by 10.229.92.132 with SMTP id r4mr3238790qcm.31.1365201342805; Fri, 05 Apr 2013 15:35:42 -0700 (PDT) In-Reply-To: <906d8c05-99dc-4209-854c-7988ca7c78e3@googlegroups.com> References: <64d4fb7c-6a75-4b5f-b5c8-06a4b2b5d0cb@googlegroups.com> <906d8c05-99dc-4209-854c-7988ca7c78e3@googlegroups.com> Date: Sat, 6 Apr 2013 06:35:42 +0800 Subject: Re: I hate you all From: Isaac To To: Python List Content-Type: multipart/alternative; boundary=14dae94ee1c715bb3104d9a4b5c4 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 127 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365201840 news.xs4all.nl 6953 [2001:888:2000:d::a6]:47323 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42861 --14dae94ee1c715bb3104d9a4b5c4 Content-Type: text/plain; charset=ISO-8859-1 You underestimated the arrogance of Python. Python 3 tab doesn't map to 4 spaces. It doesn't map to any number of spaces. Tabs and spaces are completely unrelated. If you have a function having the first indentation level with 4 (or any number of) spaces, the next line starting not with 4 spaces but instead with a tab always lead you to the TabError exception. If you like to play tricks, you can use "4 spaces plus a tab" as the next indentation level. I'd rather not do this kind of things, and forget about use using tabs at all. You are out of luck if you want to play the tab-space tricks, but if you follow the lead, you'll soon find that code will be more reliable without tabs, especially if you cut-and-paste code of others. On Sat, Apr 6, 2013 at 6:04 AM, wrote: > On Saturday, April 6, 2013 12:55:29 AM UTC+3, John Gordon wrote: > > In <64d4fb7c-6a75-4b5f-b5c8-06a4b2b5d0cb@googlegroups.com> > terminatorul@gmail.com writes: > > > > > How can python authors be so arrogant to impose their tabs and spaces > > > options on me ? It should be my choice if I want to use tabs or not ! > > > > You are free to use tabs, but you must be consistent. You can't mix > > tabs and spaces for lines of code at the same indentation level. > > They say so, but python does not work that way. This is a simple script: > > from unittest import TestCase > > class SvnExternalCmdTests(TestCase) : > def test_parse_svn_external(self) : > for sample_external in sample_svn_externals : > self.assertEqual(parse_svn_externals(sample_external[0][0], > sample_external[0][1]), [ sample_external[1] ]) > > And at the `for` statement at line 5 I get: > > C:\Documents and Settings\Adrian\Projects>python sample-py3.py > File "sample-py3.py", line 5 > for sample_external in sample_svn_externals : > ^ > TabError: inconsistent use of tabs and spaces in indentation > > > Line 5 is the only line in the file that starts at col 9 (after a tab). > Being the only line in the file with that indent level, how can it be > inconsistent ? > > You can try the script as it is, and see python 3.3 will not run it > -- > http://mail.python.org/mailman/listinfo/python-list > --14dae94ee1c715bb3104d9a4b5c4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
You underestimated the arrogance of Python.=A0 Python 3 ta= b doesn't map to 4 spaces.=A0 It doesn't map to any number of space= s.=A0 Tabs and spaces are completely unrelated.=A0 If you have a function h= aving the first indentation level with 4 (or any number of) spaces, the nex= t line starting not with 4 spaces but instead with a tab always lead you to= the TabError exception.

If you like to play tricks, you can use "4 spaces plus a tab"= as the next indentation level.=A0 I'd rather not do this kind of thing= s, and forget about use using tabs at all.=A0 You are out of luck if you wa= nt to play the tab-space tricks, but if you follow the lead, you'll soo= n find that code will be more reliable without tabs, especially if you cut-= and-paste code of others.


On Sat,= Apr 6, 2013 at 6:04 AM, <terminatorul@gmail.com> wrot= e:
On Saturday, April 6, 2013= 12:55:29 AM UTC+3, John Gordon wrote:
> In <64d4fb7c-6a75-4b5f-b5c8-06a4b2b5d0cb@googlegroups.com> terminatorul@gmail.com writes: >
> > How can python authors be so arrogant to impose their tabs and sp= aces
> > options on me ? It should be my choice if I want to use tabs or n= ot !
>
> You are free to use tabs, but you must be consistent. =A0You can't= mix
> tabs and spaces for lines of code at the same indentation level.

They say so, but python does not work that way. This is a simple scri= pt:

from unittest import TestCase

class SvnExternalCmdTests(TestCase) :
=A0 =A0 def test_parse_svn_external(self) :
=A0 =A0 =A0 =A0 for sample_external in sample_svn_externals :
=A0 =A0 =A0 =A0 =A0 =A0 self.assertEqual(parse_svn_externals(sample_externa= l[0][0], sample_external[0][1]), [ sample_external[1] ])

And at the `for` statement at line 5 I get:

C:\Documents and Settings\Adrian\Projects>python sample-py3.py
=A0 File "sample-py3.py", line 5
=A0 =A0 for sample_external in sample_svn_externals :
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 ^
TabError: inconsistent use of tabs and spaces in indentation


Line 5 is the only line in the file that starts at col 9 (after a tab). Bei= ng the only line in the file with that indent level, how can it be inconsis= tent ?

You can try the script as it is, and see python 3.3 will not run it
--
http://mail.python.org/mailman/listinfo/python-list

--14dae94ee1c715bb3104d9a4b5c4--