3 ms·
Even if you figured out a way to do this, it's wrong wrong wrong. Everyone using an API has a natural and correct expectation that keyword arguments will be ord
by pekk 13y ago
Even if you figured out a way to do this, it's wrong wrong wrong. Everyone using an API has a natural and correct expectation that keyword arguments will be order-insensitive. Making them order-sensitive is just begging for trouble.
- Tehnix 13y agoIf they are, by default, order-insensitive, then it should pose no problem at all to make them order-sensitive, since you would not know what order they would appear in either way. Now, if you had said the other way around (ppl expect them to be order-sensitive but they are order-insensitive), that would have made sense...
- frobozz 13y agoNo. Because normal behaviour is order-insensitive, I expect that f(a=1,b=2) and f(b=2,a=1) should have identical behaviour. If you make the arguments order-sensitive, then they may not. If, for readability reasons, I change the order of the arguments, I will then be surprised when my code stops working. Conversely, If (because I think it is order-sensitive) I believe that, in order to make the function do what I want, I have to call f(a=1,b=2) and not f(b=2,a=1), then I'm not going to change the order willy-nilly, so I won't be affected by my expectations not matching reality.