😏
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
from collections.abc import Callable, Iterable
|
||||
from typing import Any
|
||||
|
||||
|
||||
def stable_unique(values: Iterable[Any], key: Callable[[Any], Any]) -> list[Any]:
|
||||
result = []
|
||||
for value in values:
|
||||
if not any(key(existing) == key(value) for existing in result):
|
||||
result.append(value)
|
||||
return result
|
||||
Reference in New Issue
Block a user