[SciPy-dev] tidy up code before 1.0

Fernando Perez Fernando.Perez at colorado.edu
Fri Feb 3 11:08:35 CST 2006


Charles R Harris wrote:
> On 2/2/06, Fernando Perez <Fernando.Perez at colorado.edu> wrote:
> 
>>[snip]
>>+1.  In particular, TABs should be absolutely forbidden: mixed tab/space
>>code
>>is a recipe for disaster in python (it's happened to me in the past with
>>patches for ipython, and the resulting bugs can be maddening to track, as
>>the
>>code may actually appear correct on your screen depending on your
>>particular
>>choice of tab/space display settings).
> 
> 
> 
> In vim I set tabs and soft tabs to different values (8 and 4) so that the
> true tabs show up and can be removed.

Well, it's still possible to be visually tripped even with this safeguard in 
place:

if foo:
     if bar:
         baz
	bang

Where does bang go?  It looks like it goes below bar, but it's meant to be 
only indented one level.  If the logic of the code isn't obvious enough, 
something like this can _very easily_ go unnoticed.  It's happened to me in 
the past, and it has caused me hours of bug hunting.

 From past experience, mixed tabs/spaces in python are just a bad idea.  IMO, 
they should raise a syntax error, period.

Cheers,

f




More information about the Scipy-dev mailing list