shot of post - 💭 Show some equivalent list comprehensions in filter examples · ...

Here's my thought on 💭 Show some equivalent list comprehensions in filter examples · ...


I often want to reach for non existing list comprehensions in jinja 2, Here are a few nice equivalents.

a: {{ data | selectattr('x', 'gt', 5) | list }}
b: {{ data | map(attribute='c') | list }} 
c: {{ data | selectattr('x', 'gt', 5) | map(attribute='c') | list }} 

!!! note This post is a thought. It's a short note that I make about someone else's content online. Learn more about the process [[ thoughts ]]

{.text-opacity-80} This post was a thought by Waylon Walker see all my thoughts at https://waylonwalker.com/thoughts