Indentation

To keep the indentation between Python code blocks it is possible to use comments:

<html><body>
<%
for i in range(10):
   # This comment sets the indentation that will last until
   # another command or comment changes it
%>
<p><%= i %></p>
<%
# This comment finishes the loop indentation
# otherwise the next line would be repeated for all values of i
%>
</html></body>

A nested loop sample:

<html><body>
<%
for i in range(10):
   # for i loop start
%>
<p><%= i %>
<%
   for j in range(i +1, 10):
      # for j loop start
%>
<%= j %>
<%
   # This comment marks the end of the for j loop
%>
</p>
<%
# end of the for i loop
%>
</html></body>

View the Python code generated by the PSP parser side by side with the above script.