<div dir="ltr">> 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.<div><br></div><div>Yes, strings are iterables. You can use a string as argument of str.join method.</div><div>But only strings can be used as separators, so there is non need for a generic join method for all types of separators.</div><div><br></div><div>Python is well designed, you are just not used to it</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-09-14 21:31 GMT+02:00 Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Sep 15, 2017 at 5:06 AM, Jason H <<a href="mailto:jhihn@gmx.com">jhihn@gmx.com</a>> wrote:<br>
><br>
>>> Why is it ','.join(iterable), why isn't there join(',', iterable)<br>
><br>
>> Because join apply on a string, and strings are defined by the str class, not by a specific protocol (unlike iterables).<br>
> 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.<br>
<br>
</span>There is __iter__, but no next() or __next__() on the string itself.<br>
__iter__ makes something iterable; __next__ is on iterators, but not<br>
on all iterables.<br>
<br>
>>> "abc".__iter__()<br>
<str_iterator object at 0x7fce2b672550><br>
<span class=""><br>
> 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.<br>
><br>
<br>
</span>"We" are making it harder? Who's "we"? Python predates JavaScript by a<br>
few years, and the latter language was spun up in less than two weeks<br>
in order to create an 'edge' in the browser wars. So I don't think<br>
anyone really planned for anyone to write multi-language code<br>
involving Python and JS.<br>
<br>
ChrisA<br>
<div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Antoine Rozo</div></div>
</div>