Add some docstrings

This commit is contained in:
Andras Schmelczer 2022-07-10 13:21:08 +02:00
parent 63a45989f4
commit 2b378114aa
No known key found for this signature in database
GPG key ID: 0EA1BC97D0AB076E
5 changed files with 126 additions and 0 deletions

View file

@ -11,8 +11,10 @@ def unique(values: Iterable[T], *, key: Callable[[T], Any] = lambda v: v) -> Lis
Examples:
>>> unique([1, 1, 5, 3, 3])
[1, 5, 3]
>>> unique([{'a': 1, 'b': 2}, {'a': 1, 'b': 3}], key=lambda v: v['a'])
[{'a': 1, 'b': 2}]
>>> unique([{'a': 1, 'b': 2}, {'a': 1, 'b': 3}], key=lambda v: v['b'])
[{'a': 1, 'b': 2}, {'a': 1, 'b': 3}]