Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'syntax': 0.04; 'argument': 0.05; 'insert': 0.05; 'received:134': 0.05; 'parser': 0.07; 'suddenly': 0.07; 'forcing': 0.09; 'inserted': 0.09; 'logic': 0.09; 'spaces': 0.09; 'python': 0.11; "(i'm": 0.16; 'braces': 0.16; 'ignored,': 0.16; 'immediatly,': 0.16; 'other,': 0.16; 'subject:after': 0.16; 'subject:beginner': 0.16; 'tab': 0.16; 'tabs': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'wed,': 0.18; 'possible,': 0.19; 'machine': 0.22; 'settings': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; "aren't": 0.24; 'either.': 0.24; 'simpler': 0.24; 'holds': 0.26; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'chris': 0.29; "doesn't": 0.30; 'mix': 0.30; 'code': 0.31; 'easier': 0.31; 'usually': 0.31; 'aligned': 0.31; 'indentation': 0.31; 'another': 0.32; 'maybe': 0.34; "i'd": 0.34; 'problem': 0.35; "can't": 0.35; 'agree': 0.35; 'something': 0.35; 'done.': 0.35; 'editor': 0.35; 'but': 0.35; 'there': 0.35; 'consistent': 0.36; 'vice': 0.36; 'doing': 0.36; 'should': 0.36; 'turn': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'anything': 0.39; 'expect': 0.39; 'to:addr:python.org': 0.39; 'space': 0.40; 'tell': 0.60; 'first': 0.61; "you'll": 0.62; 'show': 0.63; 'school': 0.64; 'different': 0.65; '30,': 0.65; 'subject:day': 0.69; 'subject:First': 0.74; 'consistenly': 0.84; 'forced': 0.84; 'pain': 0.84; 'pardon': 0.84; 'pasting': 0.84; 'water.': 0.84; 'subject:add': 0.91; 'trouble.': 0.91; '2013': 0.98 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4EAGX+cFKGuA9G/2dsb2JhbABZw2CBPIMZAQEEAXgGCwsYCRYPCQMCAQIBRRMGAgKHfQaxbokUj1YWhBYDmAqGKYtggyc Date: Wed, 30 Oct 2013 13:42:37 +0100 From: Antoon Pardon User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: python-list@python.org Subject: Re: First day beginner to python, add to counter after nested loop References: <4d1c9a55-310b-41b7-8271-435fd095ce70@googlegroups.com> <7e0b17ea-3a79-45e7-aefc-795f3f34af95@googlegroups.com> <20e6a79f-2d0e-4e78-8af6-607375eca676@googlegroups.com> <5270F529.5040307@rece.vub.ac.be> In-Reply-To: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1383136979 news.xs4all.nl 15863 [2001:888:2000:d::a6]:48310 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:58031 Op 30-10-13 13:17, Chris Angelico schreef: > On Wed, Oct 30, 2013 at 11:01 PM, Antoon Pardon > wrote: >> Because it is a pain in the ass. Now suddenly my program doesn't work >> because I somehow inserted a tab instead of spaces. > > I broadly agree with your post (I'm of the school of thought that > braces are better than indentation for delimiting blocks), but I don't > think this argument holds water. All you need to do is be consistent > about tabs OR spaces (and I'd recommend tabs, since they're simpler > and safer), and you'll never have this trouble. Easier said than done. First of all I can be as consistent as possible, I can't just take code from someone else and insert it because that other person may be consistenly doing it different from me. Then if you are working on different machines, the settings of your editor may not always be the same so that you have tabs on one machine and spaces on an other, which causes problem when you move the code. Also when you have an xterm, selecting a tab and pasting it into another it will turn the tab into spaces. All these things usually can be ignored, they typically only show up when you print something and things aren't aligned as you expect but with python you are forced to correct those things immediatly, forcing you to focus on white space layout issues instead of on the logic of the code. > Also, the parser > should tell you if you mix tabs and spaces, so that won't trip > anything either. Maybe you mean something differen than I understand but a program throwing a syntax error because there is a tab instead of a number of spaces or vice versa, is something I would understand as tripping. -- Antoon Pardon