Actually these are "fake" bloc delimiters (in the shape of comments, see example in the original post).<br><br>By this I mean they are used by the formatting tool (pindent) only, not by the language (Python itself).<br>
<br>They are (generated by and used by) pindent for the sake of being able to fix the indent level in python code when :<br><div style="margin-left: 40px;"><ol><li>A copy / paste went bad (e.g. the last line of a for bloc has been "pasted at the wrong indentation level").</li>
<li>A source file lost all indentation when been mailed because, say, the tabs have been stripped</li><li>etc... <br></li></ol></div><br>I do not see how there can be an equivalent of gofmt if there is no *indication* of the end of the blocs (independent of the indentation, that is).<br>
<br><br>It is my feeling that without such a tool Python is inherently very vulnerable to glitches occurring at editing time:<br><ol><ol><li>Copy / paste glitch that passes unnoticed, does not generate an exception but alters the logic of the program.</li>
<li>Tab key inadvertently hit.</li><li>Difficulty in assessing the target indentation level when a part of a bloc has to be pasted in a different part of the code. <br></li></ol></ol><br>Serge Hulne.<br><br><br><br><div class="gmail_quote">
On Thu, May 26, 2011 at 7:29 AM, Serge Hulne <span dir="ltr"><<a href="mailto:serge.hulne@gmail.com">serge.hulne@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<span></span><span>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" target="_blank">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>It provides bloc delimiters (end of blocks) in the for of comments (like "#end if" or "#end for" etc ... )</span></li>

<li><span>This allows one to check / restore the indentation of Python code, in cases where></span></li><ol><li><span>A copy/paste went wrong</span></li><li><span>The indentation of a Python source got corrupted when the script was posted on web page, send via email etc ...</span></li>

<li><span>Standardise (fix) sources which happily mix whitespaces and tabs <br></span></li><li><span>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> 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>
</blockquote></div><br>