Dec. 17, 2019
8:28 a.m.
17.12.19 14:05, Ivan Levkivskyi пише:
As a random data point, I often see the pattern where one needs to remove duplicates from the list while preserving the order of first appearance. This is for example needed to get stability in various type-checking situations (like union items, type variables in base classes, type queries etc.)
One can write a four line helper to achieve this, but I can see that having order preserving set could be useful. So again, it is "nice to have but not really critical".
This is a one-liner: list(dict.fromkeys(iterable))