I am a totally blind programmer who would like to learn Python. Unfortunately the fact that code blocks are represented with different levels of indentation is a major stumbling block. I was wondering if there were any tools available that would allow me to write code using braces or some other code block delimiter and then convert that format into a properly indented representation that the Python interpreter could use?
I am a totally blind programmer who would like to learn Python. Unfortunately the
Share
There’s a solution to your problem that is distributed with python itself.
pindent.py, it’s located in the Tools\Scripts directory in a windows install (my path to it is C:\Python25\Tools\Scripts), it looks like you’d have to grab it from svn.python.org if you are running on Linux or OSX.It adds comments when blocks are closed, or can properly indent code if comments are put in. Here’s an example of the code outputted by pindent with the command:
pindent.py -c myfile.pyWhere the original
myfile.pywas:You can also use
pindent.py -rto insert the correct indentation based on comments (read the header of pindent.py for details), this should allow you to code in python without worrying about indentation.For example, running
pindent.py -r myfile.pywill convert the following code inmyfile.pyinto the same properly indented (and also commented) code as produced by thepindent.py -cexample above:I’d be interested to learn what solution you end up using, if you require any further assistance, please comment on this post and I’ll try to help.