Skip to content

Release 0.3.1: Addition of distinct_by

Compare
Choose a tag to compare
@EntilZha EntilZha released this 22 Jul 23:25
· 361 commits to master since this release

This is a very minor release which adds distinct_by to the API. distinct_by takes a single identity function as argument. The returned sequence is unique by the identity function and consists of the first element found for each identity key. Code example below:

from functional import seq

seq([(1, 2), (1, 3), (2, 3), (4, 5), (0, 1), (0, 0)]).distinct_by(lambda x: x[0])
# [(0, 1), (1, 2), (2, 3), (4, 5)]