2 ms·
If join were a method on lists then you wouldn't be able to use it with other iterables. Putting it on str is more useful, if more confusing. Maybe it would be
by duckerude 5y ago
If join were a method on lists then you wouldn't be able to use it with other iterables. Putting it on str is more useful, if more confusing.
Maybe it would be better as a standalone function. But then you'd either have to import it or it would pollute the global namespace.
Other OOP models offer different solutions.
- leephillips 5y agoThe Julia join function works on any iterable whose members are or can be converted into strings.
- adgjlsfhk1 5y agoThat requires multiple dispatch.