4 ms·
It is a silly type for a function to return, because you have three levels of data structure nesting, with not one bit of information about the meaning of any o
by int_19h 5y ago
It is a silly type for a function to return, because you have three levels of data structure nesting, with not one bit of information about the meaning of any of the values except their types. If I call your function and then do result[1][2], what does that mean?
This is exactly the kind of situation where you're supposed to use a named tuple or a data class to make it clear what's what.
- wheelerof4te 5y agoWith tuples inside of lists, you usually unpack them to variables in a for loop. Named tuples are just immutable classes with slots. Unless you want to slow your code down considerably, it's best to avoid them.