3 ms·
I have found, at least in my own use of python, lists are for "homogeneous" collections of indeterminate length. But these are not strictly homogeneous - there
by sseagull 5y ago
I have found, at least in my own use of python, lists are for "homogeneous" collections of indeterminate length. But these are not strictly homogeneous - there may be None entries, for example. So I do use the heterogeneous capabilities.
For heterogeneous collections with a fixed length, I tend to use a tuple. That makes more sense to me, conceptually (coming from C++).
- joconde 5y agoIn Python’s type annotation system, “class T or None” is represented by “typing.Optional[T]”. I think C++ has something similar for STL containers. Even numpy has NaN values. So your usage still fits some reasonable definition of homogeneous :)