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))
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/2P43G6N2MKQPSNVB4TBWY2ZHAOEISDPT/
Code of Conduct: http://python.org/psf/codeofconduct/