{%- with next_class = cycler(["odd", "even"]) %} {%- endwith %} {%- for item in real_iter %} - {{ item }} ({{ loop.index }} from {{ loop.length|default("?") }}) {%- endfor %}