Whitespace as syntax (was Re: Python Rocks!)

Mikael Olofsson mikael at isy.liu.se
Wed Feb 9 05:19:54 EST 2000


On 09-Feb-00 Thomas Hamelryck wrote:
 >  Mix tabs and spaces and you can get errors that are not visible.
 >  Try it. 

As a number of people have pointed out: Don't! I for one never do. As 
long as you alone do the programming, this is safe. If, on the other 
hand, you have to hack in someone else's code, assume a tab setting of
8 spaces, since that is what the interpreter does. If the code worked 
for that someone else, then 8 it is.

I would actually prefer that the interpreter regarded mixed tabs/spaces
indentation as an error, or at least that it produced a warning. The best 
thing IMO would be if the interpreter only accepted one of these 
indentation tokens, preferably tabs I think. If that was the case, then 
these discussions would be less frequent, and we could concentrate on the 
beauty of indentation. However, as I understand things, there is already 
a lot of code out there with mixed tabs/spaces indentation. So, for the 
sake of backwards compatibility, I guess we will have to live with an 
interpreter that is sloppy in this respect.

And don't say that I can rewrite the interpreter. _I_ can't! I leave 
that to the gurus out there, if someone is interested. I, simpleminded
as I am, am glad that I can write a working program in whatever language 
there is. For the moment it is python.

long-moment;-a-couple-of-years'ly y'rs

/Mikael

-----------------------------------------------------------------------
E-Mail:  Mikael Olofsson <mikael at isy.liu.se>
WWW:     http://www.dtr.isy.liu.se/dtr/staff/mikael
Phone:   +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date:    09-Feb-00
Time:    10:48:05

This message was sent by XF-Mail.
-----------------------------------------------------------------------



More information about the Python-list mailing list