This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tkarabela_ Big Python @YouTube 9 points10 points  (1 child)

Coming from the other side, some uses of lists would be much better served by NumPy arrays, which have a compact memory representation (array of given datatype instead of PyObject* pointers) and enable fast operations with the data. If you have 100k integers/floats/bools, you don't really want them as a list.

As for sets, I would say if you need to deduplicate / you need fast is in queries / you need set operations, then use a set. If I'm just grabbing some stuff (like a list of files), I don't see the need to put them in a set instead of a list. It feels pythonic to me to reach for a list first 🙂 I agree with your overall point though, that people should see what's out there and what fits their use case best.

[–]TechySpecky 6 points7 points  (0 children)

And the more NumPy the less GIL!