Skip to content
Myr

clarify groupby behavior in docs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Roy Revelt · committed by David Lord · parent 8e3c0e7 · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:jinja2/filters.py+4 added-4 removed
886 unmodified lines
887 {% endfor %}</ul></li>888 {% endfor %}889 </ul>890891 Additionally it's possible to use tuple unpacking for the grouper and892 list:891 Additionally it's possible to use tuple unpacking for the grouper892 (`gender` in this example) and `list`:893894 .. sourcecode:: html+jinja895896 <ul>897 {% for grouper, list in persons|groupby('gender') %}897 {% for gender, list in persons|groupby('gender') %}898 ...899 {% endfor %}900 </ul>901902 As you can see the item we're grouping by is stored in the `grouper`902 As you can see the item we're grouping by is stored in the ``gender``903 attribute and the `list` contains all the objects that have this grouper904 in common.905906 .. versionchanged:: 2.6
356 unmodified lines