[Tutor] Indentation Issue and Blind People

Dave Kuhlman dkuhlman at rexx.com
Sun Dec 2 18:13:06 CET 2007


On Fri, Nov 30, 2007 at 11:34:05AM -0800, jim stockford wrote:
> 
>     you might consider keeping your code at two
> spaces and when/if the need arises to share
> your code, write a little filter program that
> translates the two-space indents to four.
>     very interesting idea to play piano notes.
> how'd you do that?

Tools for this already exist.  On Linux/UNIX, they might look like
the following:

  Convert from 2 space indents into 4 space indents:
    $ cat oldfile.py | unexpand -t 2 | expand -t 4 > newfile.py

  Convert from 4 space indents into 2 space indents:
    $ cat oldfile.py | unexpand -t 4 | expand -t 2 > newfile.py

If you are on MS Windows, I believe that you can get replacements
for the above tools here:

    http://unxutils.sourceforge.net/

Also look at scripts contained in the Tools/scripts/ directory of
the Python source code distribution.  In particular, these may be of
interest: reindent.py and tabify.py.  And, for those who feel that
they must have some marker at the end of a block (in addition to an
"out-dent"), look at Tools/scripts/pindent.py.

Dave

-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman


More information about the Tutor mailing list