<span class="il"></span><span class="il">Suggestion: Integrate the script "pindent.py" as standard command for formatting pyhton code<br><br>Here is the link;<br><a href="http://svn.python.org/projects/python/trunk/Tools/scripts/pindent.py">http://svn.python.org/projects/python/trunk/Tools/scripts/pindent.py</a><br>
<br>Pindent stands for "Pyton indent":<br><br>Goal : <br></span><ol><li><span class="il">It provides bloc delimiters (end of blocks) in the for of comments (like "#end if" or "#end for" etc ... )</span></li>
<li><span class="il">This allows one to check / restore the indentation of Python code, in cases where></span></li><ol><li><span class="il">A copy/paste went wrong</span></li><li><span class="il">The indentation of a Python source got corrupted when the script was posted on web page, send via email etc ...</span></li>
<li><span class="il">Standardise (fix) sources which happily mix whitespaces and tabs <br></span></li><li><span class="il">Make Python code more readable for developers used to end of blocs delimiters (Ruby, C, C++, C#,Java, etc ...)<br>
</span></li></ol></ol><span class="il"> Basically the idea is the same as the Go language "gofmt" (Go format).<br><br>Example:<br><br>#-------------------<br>- Before using pindent:<br><br>#!/usr/bin env python<br>
<br>i = 0<br>for c in "hello world":<br> if c == 'l':<br> i+=1<br> print "number of occurrences of `l` :", i<br><br>#------------------<br>- After using indent:<br><br>#!/usr/bin env python<br>
<br>i = 0<br>for c in "hello world":<br> if c == 'l':<br> i+=1<br> print "number of occurrences of `l` :", i<br> # end if<br># end for<br><br><br>Serge Hulne<br></span>