Python web development that resembles PHP or classic ASP
Bruno Desthuilliers
bruno.42.desthuilliers at websiteburo.invalid
Tue May 27 03:10:40 EDT 2008
Ivan Illarionov a écrit :
> On Mon, 26 May 2008 21:26:55 +0200, Sebastian 'lunar' Wiesner wrote:
>
>> [ Ivan Illarionov <ivan.illarionov at gmail.com> ]
>>
>>> If the OP wants PHP-style programming he will get better results with
>>> PHP because PHP was designed this way. Any Pythonic solution will be an
>>> overkill.
>> Better shoot yourself in the foot with a PHP-like Python-thing, than
>> committing suicide by shooting yourself into the head with PHP ...
>
> :) I can't imagine anything uglier than Python with its significant
> whitespace wrapped inside HTML. I guess it could be more damaging than
> PHP which was written exactly for this purpose.
Mako template's syntax looks not so ugly to me:
<%inherit file="base.html"/>
<% rows = [[v for v in range(0,10)] for row in range(0,10)] %>
<table>
% for row in rows:
${makerow(row)}
% endfor
</table>
<%def name="makerow(row)">
<tr>
% for name in row:
<td>${name}</td>\
% endfor
</tr>
</%def>
More information about the Python-list
mailing list