Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You are misremembering, Jinja uses python syntax like a sane language so it would be `{% set foo = ["alpha", "beta"] %} {{ foo[1] }}` not `{{ foo.[1] }}` like they use. I actually probably wouldn't have chirped about it if they used the alternate syntax (also supported by Jinja) of `{{ foo.1 }}` but the belt-and-suspenders of requiring the array brackets and the dot is just ... why?


`{{ foo.1 }}` is supported and initially was the only syntax to index arrays. But with the need to index arrays with the help of other variables came the introduction of optional `[]` to encapsulate nested vars from the the top level var. Will update the documentation page in the next hours to also showcase `{{ foo.1 }}`. Thanks for the heads up




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: