Join GitHub today
Instrument iterables ala jinja ? #125
Migrated issue, originally created by Michael Bayer (@zzzeek)
i.e. user does this:
we see the magic name "lastelement". We then compile to this:
tentative 0.3 feature. May come out.
Philip Jenvey (@pjenvey) wrote:
I don't like this kind of magic. Some of the loop attributes Jinja provides could use enumerate or itertools.cycle instead, only the ones taking into account the end index of the loop aren't easily done
But how useful are those in practice anyway? Useful enough to warrant the magic? In some simpler cases you can even replace a check for the end of the loop with a check for the beginning of the loop, e.g.