Tabnanny really useful?

Franz Steinhaeusler franz.steinhaeusler at utanet.at
Tue Dec 21 10:39:14 EST 2004


On Tue, 21 Dec 2004 09:06:12 -0600, "John Roth"
<newsgroups at jhrothjr.com> wrote:

>
>"Steve Holden" <steve at holdenweb.com> wrote in message 
>news:qIVxd.57751$Jk5.26179 at lakeread01...
>
>> Do you think tabnanny is a useful piece of code now? I used it a lot when 
>> I first started using Python, and still run it over code from unknown 
>> sources (no pun intended) from time to time.
>
>I think it's a lot less useful today than it was a few
>years ago, but it's still useful if you're stuck with an
>editor that doesn't give you a robust set of options,
>or if you've got to check a lot of modules in a library.
>
>I think most python-aware editors have included
>the needed functionality, or at least some reasonable
>approximation.
>
>I know what I would like to see in an editor:
>
>First, it autodetects whether the module uses
>tabs consistently, spaces consistently or a
>mixture. If it uses tabs consistently, it then
>uses the current default.
>

>If it uses spaces consistently, it should also
>autodetect the indentation setting in use in
>the module and offer to change it if it's
>different from the current default indentation
>setting.
>
>If it's inconsistent, it should make an attempt
>to deduce the model the creating software
>used; if it can it should change it to the
>default setting without complaining. Otherwise
>it should complain.


Again, DrPython does this almost as you described ;)

There is an option in the preferences:
"Use File's Indentation"

and the indent setttings are set to the one,
what is found in the opened source file.

In the status line, the mode "SPACES" or "TABS" or
"MIXED" is displayed.

There are also the functions:
Edit=>Whitespace=>Check Indentation
Edit=>Whitespace=>Set Indentation to spaces 
	(replaces all tabs with the preset nr of spaces for tab

Exception 1:
	 (it could set then the tab mode to spaces)
and respectively:
Edit=>Whitespace=>Set Indentation to spaces 

Exception 2:

If open a file, there could be a check, whether 
tabs and spaces indentations are mixed, try to correct
if possible or complain (let the user decide).

=> Feature Request ;)

regards,
-- 
Franz Steinhaeusler



More information about the Python-list mailing list