I'm sure you know that the idea of using code in templates is controversial anyway. But I do like it, and Mako, imo, solves the issue with Python very well.
% for row in rows:
* Here is a row: ${row}
% endfor
http://www.makotemplates.org/That's kind of 'hackish', but not bad at all if you ask me.
Compared to an ERB snippet it is about the same (though you'd probably use each and a block here in Ruby.
<% for row in row %>
* <%= row %>
<% end %>