0

set() is not an option, it only works with iterables, that contain hashable items. Currently I'm using this function:

def exclusive(arr):
        return arr.__class__({str(i):i for i in arr}.values())

Is there a builtin one? P.S. Don't suggest your functions. I only ask for a builtin one.

LazyBum Q
  • 237
  • 3
  • 11
  • https://stackoverflow.com/a/38521207/9835872 ? – ruohola Sep 20 '21 at 05:42
  • Does this answer your question? [Removing duplicates in lists](https://stackoverflow.com/questions/7961363/removing-duplicates-in-lists) – aim97 Sep 20 '21 at 05:44
  • 1
    Your question is unclear. Your question title specifies lists only and lists are iterables, so what's wrong with using a `set`? Also sets are not limited to immutable items. Did you mean hashable? – Selcuk Sep 20 '21 at 05:51
  • And have you considered `frozenset`? – BoarGules Sep 20 '21 at 07:54

0 Answers0