News for hackers. Stuff that matters.
Re:How Python List Works by abecedarius on Sunday November 14, 2021 @03:18PM (#29220267)
The times I've used array, it was a common data structure for communicating with a C extension. You could use a Python list, but that's not just slower but more of a pain to deal with on the C side. (This was before numpy was everywhere; I don't know how much fun that might be to work with from C.)

If you're going pure Python then space is a better reason than speed. I'm not sure an array is even as fast as a list.

Re:How Python List Works by uranusjr on Sunday November 14, 2021 @04:22PM (#29220849)
I think I use struct much more when interfacing with C, but I can see array being useful for arrays specifically when you expect more than a couple of elements. Both are still quite niche though.