Re:What's New in Python 3.11?
by jraph on Monday June 27, 2022 @03:26AM
(#31891574)
I don't know Go, however checking if an element is in an array, even unsorted, is likely faster than anything involving a linked list or a hash map unless the equality test is very expensive (maybe) if the array is small enough. And it is often small enough. I don't know how small, I guess it depends on the computer and the implementation, but 100 is probably still fine.
So, yes, let's have a contains function on (unsorted) arrays.
So, yes, let's have a contains function on (unsorted) arrays.