2 ms·
When I taught Python, the way I explained was that a tuple is basically one value, shrinkwrapped. It's one value so that you can put anywhere that expects a val
by euske 10y ago
When I taught Python, the way I explained was that a tuple is basically one value, shrinkwrapped. It's one value so that you can put anywhere that expects a value (such as a return value or a key of a dictionary). Also it's one value so you cannot change it.
The way you look at a statement like (a,b) = (2,3) is that this is a normal assignment, where you imagine there are one value flowing in the equal sign, from right to left. But it happens to contain two values within its wrap.