whitespace.py module

Gordon McMillan gmcm at hypernet.com
Wed Nov 24 15:01:34 EST 1999


Rajesh Vaidheeswarran writes:
> 
> I'm new to the python language, and the newsgroup. So, if this
> newsgroup is not appropriate for this type of posting, please
> pardon my ignorance and notify me.
> 
> I have written up a module called `whitespace.py' available at
> <URL:http://www.dsmit.com/python/>
> 
> and a sample program `whitespace' which uses this module, also
> available at the same URL.
> 
> The module can be used to check a given file for whitespace
> problems as defined in the module's documentation (also available
> as a separate text document at
> <URL:http://www.dsmit.com/lisp/whitespace.txt>.
> 
> Please feel free use these, and also to send in your comments on
> either of these.

I had a quick look. You are taking the opposite approach from 
the recommended way of dealing with tabs. The 
recommended approach is to set your editor to always insert 
spaces. That way, someone else reading your code will 
always see sane indentation, no matter how they have 
configured their editor (or what the editor assumes). You'll also 
make email clients happy (since they almost always turn 
leading tabs into spaces).

It's also acceptable to use only tabs for indentation.

> I would like to know how to submit a module for inclusion into
> the standard python distribution, and would appreciate any
> pointers in that direction.

There's already a whitespace troubleshooter in the std lib - 
tabnanny.py (check out python -t ).

You can transform any legal style of indentation to any other 
legal style with tabcleaner.py in the System directory of the 
contrib ftp site.

- Gordon




More information about the Python-list mailing list