On Fri, Sep 15, 2017 at 5:06 AM, Jason H <jhihn@gmx.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.
"abc".__iter__() <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.
"We" are making it harder? Who's "we"? Python predates JavaScript by a few years, and the latter language was spun up in less than two weeks in order to create an 'edge' in the browser wars. So I don't think anyone really planned for anyone to write multi-language code involving Python and JS. ChrisA