<div dir="auto">So you'd propose to add some kind of <div dir="auto"><br></div><div dir="auto">def Join(sep, *args):</div><div dir="auto">     return sep.join(map(str, args))</div><div dir="auto"><br></div><div dir="auto">To the standard lib ?</div><div dir="auto"><br></div><div dir="auto">Or to add another method to str class that do that ?</div><div dir="auto"><br></div><div dir="auto">class str:</div><div dir="auto">     ...</div><div dir="auto">     def Join(self, *args):</div><div dir="auto">         return self.join(map(str, args))</div><div dir="auto"><br></div><div dir="auto">I agree such a function is super convenient but does it need to be added to the standard lib I have it in my custom utils.py and my PYTHONTARTUP.py file so that I can use it everywhere.</div><div dir="auto"><br></div><div dir="auto">Call it Join, superjoin, joinargs...</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, 29 Jan 2019, 02:43 Jamesie Pic <<a href="mailto:jpic@yourlabs.org">jpic@yourlabs.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 dir="ltr"><div dir="ltr"><div>Hello,</div><div><br></div><div>During the last 10 years, Python has made steady progress in convenience to assemble strings. However, it seems to me that joining is still, when possible, the cleanest way to code string assembly.</div><div><br></div><div>However, I'm still sometimes confused between the different syntaxes used by join methods:</div><div><br></div><div>0. os.path.join takes *args</div><div>1. str.join takes a list argument, this inconsistence make it easy to mistake with the os.path.join signature<br></div><div><br></div><div>Also, I still think that:</div><div><br></div><div>'_'.join(['cancel', name])</div><div><br></div><div>Would be more readable as such:</div><div><br></div><div>['cancel', name].join('_')<br></div><div><br></div><div>Not only this would fix both of my issues with the current status-quo, but this would also be completely backward compatible, and probably not very hard to implement: just add a join method to list.<br></div><div><br></div><div>Thanks in advance for your reply</div><div><br></div><div>Have a great day<br></div><div><br>-- <br><div dir="ltr" class="m_7784868534084840875gmail_signature"><div dir="ltr"><div>∞<br></div></div></div></div></div></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>