<div dir="auto">+1 to that email !! (how to do that in email haha)</div><br><div class="gmail_quote"><div dir="ltr">On Tue, 29 Jan 2019, 21:50 Chris Barker via Python-ideas <<a href="mailto:python-ideas@python.org">python-ideas@python.org</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>A couple notes:</div><br><div class="gmail_quote"><div dir="ltr" class="m_3143997954042280703m_846055415818523836gmail_attr">On Tue, Jan 29, 2019 at 5:31 AM Jamesie Pic <<a href="mailto:jpic@yourlabs.org" target="_blank" rel="noreferrer">jpic@yourlabs.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">can you clarify the documentation<br>
topic you think should be improved or created ? "Assembling strings"<br></blockquote><div><br></div><div>I would think "assembling strings", though there is a lot out there already.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
or "inconsistencies between os.path.join and str.join" ?<br></blockquote><div><br></div><div>well, if we're talking about moving forward, then the Path object is probably the "right" way to join paths anyway :-)<br><br><font face="monospace, monospace">a_path / "a_dir" / "a_filename"</font><br><br>But to the core language issue -- I started using Python with 1.5.* and back then join() was in the string module (and is there in 2.7 still)</div><div><br></div><div>And yes, I did expect it to be a list method...</div><div><br></div><div>Then it was added as a method of the string object.<br><br></div><div>And I thought THAT was odd -- be really appreciated that I didn't need to import a module to do something fundamental.</div><div><br></div><div>But the fact is, that joining strings is fundamentally a string operation, so it makes sense for it to be there.</div><div><br></div><div>In earlier py2, I would have thought, maybe it should be a list method -- it's pretty darn common to join lists of strings, yes? But what about tuples? Python was kind of all about sequences -- so maybe all sequences could have that method -- i.e part of the sequence ABC.</div><div><br></div><div>But with > py3k, Python is more about iterables than sequences -- and join (and many other methods and functions) operate on any iterable -- and this is a really good thing.</div><div><br></div><div>So add join to ALL iterables? That makes little sense, and really isn't possible -- an iterable is something that conforms to the iterator protocol -- it's not a type, or even an ABC.</div><div><br></div><div>So in the end, join really does only make sense as string method.</div><div><br></div><div>Or Maybe as a built in -- but we really don't need any more of those.</div><div><br></div><div>If you want to argue that str.join() should take multiple arguments, like os.path.join does, then, well we could do that -- it currently takes one and only one argument, so it could be extended to join multiple arguments -- but I have hardly ever seem a use case for that.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The mistake I'm still doing after 10 years of Python<br></blockquote><div><br></div><div>hmm -- I've seen a lot of newbies struggle with this, but haven't had an issue with it for years myself.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
>>> '/'.join('some', 'path')<br>
TypeError: join() takes exactly one argument (2 given)<br></blockquote><div><br></div><div>pathlib aside, that really isn't the right way to join paths ..... os.path.jon exists for a (good) reasons. One of which is this:</div><font face="monospace, monospace"><br>In [22]: os.path.join("this/", "that")<br>Out[22]: 'this/that'</font><div><br></div><div><div>-CHB</div><br class="m_3143997954042280703gmail-Apple-interchange-newline"></div><div><br></div><div>-- <br></div></div><div dir="ltr" class="m_3143997954042280703m_846055415818523836gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R (206) 526-6959 voice<br>7600 Sand Point Way NE (206) 526-6329 fax<br>Seattle, WA 98115 (206) 526-6317 main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank" rel="noreferrer">Chris.Barker@noaa.gov</a></div></div>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank" rel="noreferrer">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div>