On Fri, Sep 15, 2017 at 5:06 AM, Jason H email@example.com wrote:
Why is it ','.join(iterable), why isn't there join(',', iterable)
Because join apply on a string, and strings are defined by the str class, not by a specific protocol (unlike iterables).
Why? I can iterate over a string. [c for c in 'abc'] It certainly behaves like one... I'd say this is inconsistent because there is no __iter__() and next() on the str class.
There is __iter__, but no next() or __next__() on the string itself. __iter__ makes something iterable; __next__ is on iterators, but not on all iterables.
<str_iterator object at 0x7fce2b672550>
I do think Python is superior in many, many, ways to all other languages, but as Python and JS skills are often desired in the same engineer, it seems that we're making it harder on the majority of the labor force.