{% set wrapped = ListLoopExtras(somelist) %}
{% for item in wrapped %}
{% if wrapped.last %}
{{ item }} is the last thing.
{% elif wrapped.odd %}
{{ item }} is at an odd index
...
{% end %}
{% end %}
These idioms are extremely common in templating, and are easy to
provide as extras
to the template language, without requiring core changes to Python.
I'd recommend that before we ask Bret and the tornado crew to include
something like
this, we build it and see how it feels so that our recommendations are
backed by real
use, rather than a whim.
Thoughts?