python newbie: some surprises

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat May 10 22:23:03 EDT 2008


En Fri, 09 May 2008 10:37:30 -0300, v4vijayakumar <vijayakumar.subburaj at gmail.com> escribió:

> On May 9, 1:48 pm, Bruno Desthuilliers <bruno.
> 42.desthuilli... at websiteburo.invalid> wrote:
>> v4vijayakumar a écrit :
>>
>> > When I started coding in python, these two things surprised me.
>>
>> > 1. my code is inconsistently indented with the combination of tabs and
>> > spaces. Even lines looked intended, but it is not.
>>
>> Then you have a problem with your code editor - not with Python.
>>
>
> Editors can not be wrong. :)
>
> I think there should be some way to say python compiler, to consider
> tab and two blank spaces equal, when tab space = 2.

It already considers tab = 8 spaces, and when invoked with -tt it rejects mixed tabs+spaces. (I would like Python rejected *any* tab used for indenting...)
There is a tool 'reindent.py' -somewhere on your Python install-, and an indentation checker 'tabnanny.py' (this one in the standard library).

-- 
Gabriel Genellina




More information about the Python-list mailing list