yet another indentation proposal

Alex Martelli aleax at mac.com
Mon Aug 20 11:43:51 EDT 2007


Aaron <cajnnjonaj at fjireanjtjprodjuctijons.com> wrote:
   ...
> That's probably what I'll end up doing.  The only drawback to that is that
> it solves the problem for me only.  Perhaps I will open source the scripts
> and write up some documentation so that other folks in a similar situation
> don't have to reinvent the wheel.  

As I pointed out in another post to this thread,
Tools/scripts/pindent.py IS open-source, indeed it's part of the Python
source distribution.  Why not use and/or adapt that?

> The only unfortunate aspect to that is 
> that blind newbies to the language will have to figure out setting up a
> shell script or batch file to pipe the output of the filter into Python on
> top of learning the language.  I admit, it's probably not that much work,
> but it is one more stumblingblock that blind newcomers will have to 
> overcome.

pindent.py's approach ensures that the tool's output is also entirely
valid Python (as it only adds comments to mark and "explain" block
ends!) so no "piping the output into Python" is at all needed; you only
need (editor-dependent) to ensure pindent.py is run when you LOAD a
Python source file into your editor.  If anything, pindent.py and/or the
screen reader of choice might be tweaked to "read out" Python sources
more clearly (e.g. by recognizing block-end comments and reading them
differently than other comments are read).


Alex



More information about the Python-list mailing list