yet another indentation proposal

Alex Martelli aleax at mac.com
Sun Aug 19 12:22:04 EDT 2007


Paddy <paddy3118 at googlemail.com> wrote:
   ...
> Can screen reaaderss be customized?

Open-source ones surely can (e.g., NVDA is an open-source reader for
Windows written in Python, <http://www.nvda-project.org/> -- alas, if
you search for NVDA Google appears to be totally convinced you mean
NVidia instead, making searches pretty useless, sigh).

> Maybe their is a way to get the screen reader to say indent and dedent
> at thee appropriate places?

There definitely should be.

> Or maybe a filter to put those wordds into the source?

.../Tools/scripts/pindent.py (comes with the Python source distribution,
and I hope that, like the whole Tools directory, it would also come with
any sensible packaged Python distribution) should already be sufficient
for this particular task.  The "indent" always happens (in correct
Python sources) on the next line after one ending with a colon;
pindent.py can add or remove "block-closing comments" at each dedent
(e.g., "# end for" if the dedent is terminating a for-statement), and
can adjust the indentation to make it correct if given a Python source
with such block-closing comments but messed-up indentation.


Alex



More information about the Python-list mailing list