Hi Andrew,
I've sort of said as much in my last reply to Nick. But maybe I can clarify further. I can imagine *someone* wanting a filtering of permutations by either identify or equality. Maybe, in fact, by other comparisons also for generality.
This might suggest an API like the following:
equal_perms = distinct_permutations(items, r, filter_by=operator.eq)
ident_perms = distinct_permutations(items, r, filter_by=operator.is_)
Or even perhaps, in some use-case that isn't clear to me, e.g.
start_same_perms = distinct_permutations(items, r, filter_by=lambda a,b: a[0]==b[0])
Or perhaps more plausibly, some predicate that, e.g. tests if two returned tuples are the same under case normalization of the strings within them.
I guess the argument then would be what the default value of 'filter_by' might be... but that seems less important to me if there were an option to pass a predicate as you liked.