| ▲ | scoofy 3 days ago | |||||||||||||||||||||||||
I’m not sure what you mean. You’re not necessarily going to know the type of a variable just by reading a random section of code… especially in Python. I absolutely going to add the type to the variable name if it’s a complex function. It’s just clearer. | ||||||||||||||||||||||||||
| ▲ | zahlman 3 days ago | parent [-] | |||||||||||||||||||||||||
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.) | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||