-
- Downloads
[FIX] website: make filter_duplicate work
itertools' groupby function expects the iterable to be sorted as hinted to in the documentation: "Generally, the iterable needs to already be sorted on the same key function." When running groupby on an unsorted iterable non-adjacent duplicates will remain: >>> from itertools import groupby >>> [e[0] for e in groupby([1, 2, 1])] [1, 2, 1] Because of this filter_duplicate would occassionally return duplicates. To resolve this sort on the key field. Afterwards sort the result on the usual inherit order: (priority, id).
Loading
Please register or sign in to comment