3 ms·
> It could even be written in a way where the order of arguments didn’t matter Well, 'hello'.join(', ') does not produce the same output as ', '.join('hello'),
by hakuseki 6y ago
> It could even be written in a way where the order of arguments didn’t matter
Well, 'hello'.join(', ') does not produce the same output as ', '.join('hello'), so the order of the arguments does matter.
- creata 6y agoPerhaps they want named arguments so that join(sep=', ', strings='hello') and join(strings='hello', sep=', ') are equivalent.
- leephillips 6y agoOK, but I was thinking along the lines of how easy it is in (for example) Julia to make methods that dispatch on types, so that your function could examine the arguments, and if one of them happens to be a single character, and the other a string or array, do the sensible thing, regardless of the order in which you typed in the arguments.