3 ms·
A good example of a use case I can think of would be to pass an (x,y) coordinate pair as a single parameter, and unpack it in the parameter definition. This wo
by unoti 11y ago
A good example of a use case I can think of would be to pass an (x,y) coordinate pair as a single parameter, and unpack it in the parameter definition. This would save having an extra line that says (x,y) = pt.
Unless I'm missing something, I don't see this as a show stopper personally, and see it as increasing readability.
- jacobolus 11y agoYou should use a namedtuple for that sort of thing, and then refer to the members as pt.x and pt.y.