| ▲ | zahlman 3 days ago | ||||||||||||||||
The point is to not care about the type. If you see `weight, radius, price = ...`, then it generally isn't going to matter whether `...` is a tuple or a list (or more exotic possibilities). What matters is that you can iterate over it, and iterating over it gives exactly three results, and the first result represents a weight, etc. If your weights need to be, say, a floating-point number of kilograms, then you establish that convention, and only mark intentional deviations from the convention (e.g. because you're doing an explicit conversion to format output). (Or you use a library like Pint to give more formality to it.) | |||||||||||||||||
| ▲ | scoofy 3 days ago | parent [-] | ||||||||||||||||
Lists are mutable, tuples are not… that’s a massive difference if I’m editing code deep in a function I wrote two years ago. | |||||||||||||||||
| |||||||||||||||||