for loops

$for{item in items} … $else … $rof

Again, the for loop directive behaves like you would
expect (like in python) except for additional $else
option for the case of an empty sequence
(note the difference to python’s $else
that is executed at end unless loop exited with
break statement).

One should note that the statement of the loop must be made up
of an iterable on the right side of an in keyword,
and whatever is on the left side of the in statement
is the loop variable or variables that get set on the evaluation
context on each iteration. This may be a single atomic variable,
a flat sequence of variables, or even something more complex.
Here’s an example of a 2-level tuple as left part of a
for loop statement:

$prefer{% data={"items":[("Apples", 7), (789, 9), ("Blue", 17)]} %}
$if{items}
<ul>
    $for{i, (item, code) in enumerate(items)}
    <li$if{i+1==len(items)} class="last"$fi>${code}:${item}</li>
    $rof
</ul>
$fi

That when rendered will produce:

[OSError: [Errno 2] No such file or directory: ‘/home/admin/qp_sites/evoque/auto/for_seq_items.txt’: File “/home/admin/py-packages/evoque/template.py”, line 291, in is_modified_since
return (last_modified < self.last_modified)
: EvalError(evoque(name=u’for_seq_items.txt’, collection=”auto”,
raw=True, filters=[evoque_html_highlight]))]