Re: how to reduce bugs due to incorrect indentation

2014-02-08 Thread Jurko Gospodnetić
Hi, On 7.2.2014. 2:20, msus...@gmail.com wrote: Based on the responses I arrived to the conclusion that there is no better solution than trying to be careful and have good testing suites. It would be possible to disable the Tab key completely ...[snipped]... Maybe a coloring of the background

Re: how to reduce bugs due to incorrect indentation

2014-02-07 Thread Roel Schroeven
msus...@gmail.com schreef: On Thursday, February 6, 2014 12:29:36 PM UTC-8, Roel Schroeven wrote: My suggestion: configure your editor to insert the appropriate amount of spaces instead of a tab when you press the tab key. You misunderstood the problem, but managed to start a Tab war! :-)

Re: how to reduce bugs due to incorrect indentation

2014-02-07 Thread Roel Schroeven
Chris Angelico schreef: But none of this would solve the OP's original issue. Whether it's a tab or spaces, unexpectedly indenting a line of code is a problem. I had misread. I thought the problem was that the OP did want to indent, but accidentally used the tab key instead of the space bar to

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Chris Angelico
On Fri, Feb 7, 2014 at 12:20 PM, wrote: > It would be possible to disable the Tab key completely and type in the spaces > all the time. (It is much less likely that one would press the space bar > accidentally four times or hold it down to get 4 spaces by mistake.) > > Unfortunately this means

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread msustik
On Thursday, February 6, 2014 12:29:36 PM UTC-8, Roel Schroeven wrote: > > My suggestion: configure your editor to insert the appropriate amount of > > spaces instead of a tab when you press the tab key. You misunderstood the problem, but managed to start a Tab war! :-) My emacs inserts 4 spac

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Chris Angelico
On Fri, Feb 7, 2014 at 10:01 AM, Asaf Las wrote: > pep8 pushed \t to dark side in Python. Only for the Python stdlib, and only because a decision has to be made one way or the other. I believe Guido stated at one point that there was only a very weak push toward "spaces only" rather than "tabs on

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Asaf Las
On Friday, February 7, 2014 12:30:17 AM UTC+2, Chris Angelico wrote: > On Fri, Feb 7, 2014 at 9:09 AM, Larry Martell wrote: > > > The Tab key is not evil, it's the tab character (Ctrl-I). I have been > > bitten by this many time when I had to work on a program written by > > another. They had the

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Chris Angelico
On Fri, Feb 7, 2014 at 9:09 AM, Larry Martell wrote: > The Tab key is not evil, it's the tab character (Ctrl-I). I have been > bitten by this many time when I had to work on a program written by > another. They had their tab stops set at 5 or 6, mine is set at 4, or > they did not have expandtab s

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Larry Martell
On Thu, Feb 6, 2014 at 4:32 PM, Ethan Furman wrote: > On 02/06/2014 12:36 PM, Larry Martell wrote: >> >> On Thu, Feb 6, 2014 at 3:29 PM, Roel Schroeven wrote: >>> >>> msus...@gmail.com schreef: While editing this file I accidentally pushed TAB on the line with 'y = z + y'.

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Ethan Furman
On 02/06/2014 12:36 PM, Larry Martell wrote: On Thu, Feb 6, 2014 at 3:29 PM, Roel Schroeven wrote: msus...@gmail.com schreef: While editing this file I accidentally pushed TAB on the line with 'y = z + y'. My suggestion: configure your editor to insert the appropriate amount of spaces instea

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Larry Martell
On Thu, Feb 6, 2014 at 3:29 PM, Roel Schroeven wrote: > msus...@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

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Roel Schroeven
msus...@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 d

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread msustik
Thanks for all the suggestions! Best, -Matyas -- https://mail.python.org/mailman/listinfo/python-list

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Grant Edwards
On 2014-02-06, msus...@gmail.com wrote: > 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'.

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Terry Reedy
On 2/5/2014 10:02 PM, msus...@gmail.com wrote: 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'. In this particular case, remove the indentation with x = y if a == 1 else z and indenting the next line is

Re: how to reduce bugs due to incorrect indentation

2014-02-05 Thread Asaf Las
On Thursday, February 6, 2014 5:02:09 AM UTC+2, msu...@gmail.com wrote: > 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

Re: how to reduce bugs due to incorrect indentation

2014-02-05 Thread Chris Angelico
On Thu, Feb 6, 2014 at 2:08 PM, Dan Sommers wrote: > On Wed, 05 Feb 2014 19:02:09 -0800, msustik wrote: > >> 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 there

Re: how to reduce bugs due to incorrect indentation

2014-02-05 Thread Dan Sommers
On Wed, 05 Feb 2014 19:02:09 -0800, msustik wrote: > 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 s

how to reduce bugs due to incorrect indentation

2014-02-05 Thread msustik
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 l