Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'configure': 0.05; 'insert': 0.05; 'bug.': 0.09; 'exercising': 0.09; 'key.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'spaces': 0.09; 'python': 0.11; 'bug': 0.12; 'changes': 0.15; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'recently.': 0.16; 'tab': 0.16; 'pushed': 0.16; 'appropriate': 0.16; 'looked': 0.18; 'commit': 0.19; 'tests': 0.22; 'header:User- Agent:1': 0.23; 'error': 0.23; 'versions': 0.24; 'question': 0.24; 'script': 0.25; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'along': 0.30; 'code': 0.31; 'lines': 0.31; 'accidentally': 0.31; 'file': 0.32; 'noticed': 0.34; 'problem': 0.35; 'something': 0.35; 'editor': 0.35; 'received:84': 0.35; 'should': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'een': 0.60; 'up,': 0.60; 'email addr:gmail.com': 0.63; 'show': 0.63; 'kind': 0.63; 'of:': 0.68; 'press': 0.70; 'therefore': 0.72; 'fortunately,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Roel Schroeven Subject: Re: how to reduce bugs due to incorrect indentation Date: Thu, 06 Feb 2014 21:29:36 +0100 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: d54c6d802.access.telenet.be User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) In-Reply-To: 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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391718592 news.xs4all.nl 2920 [2001:888:2000:d::a6]:39225 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65555 msustik@gmail.com schreef: > I had a bug in a Python script recently. The code in question was something along the lines of: > > if a == 1: > x = y > else: > x = z > y = z + y > z = z + 1 > > While editing this file I accidentally pushed TAB on the line with 'y = z + y'. > > My changes were elsewhere and I did not notice the above one line change when I looked at the diffs before commit. I should have noticed it... > > It was rare that a was 1 and therefore the problem did not show up for a while. (I know I should have had tests exercising all cases...) > > When the bug showed up, it was kind of difficult to remember what was the original intent. Fortunately, looking at old versions allowed me to find the problem commit and the bug. > > Any suggestion on how to avoid this type of error in the future? My suggestion: configure your editor to insert the appropriate amount of spaces instead of a tab when you press the tab key. Best regards, Roel -- "Met een spitsvondig citaat bewijs je niets." -- Voltaire