by dragonwriter · 13y ago · 0 comments
When you need something array-like, Python lists or arrays (the latter from the standard library array module) would be a more sensible choice. (Arrays are unidimensional, but its pretty trivial to emulate a multidimensional array with a unidimensional one.)
Python arrays should be more efficient for homogenous arrays of one of the types they are specialized for (including ints), and if the performance of the list/array is really a bottleneck in your application, there are more specialized tools available (including moving that bit off into a C extension).
There are certainly places where every bit of performance out of a collection matters, but there are more places where being able to quickly put together code that works correctly matters (for one thing, being able to quickly put together correct code makes it possible to correctly identify the bottlenecks where you need to optimize performance.)