<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
On 29/01/2019 01:40, Jamesie Pic wrote:<br>
<blockquote type="cite"
cite="mid:CAC6Op1-TNV+-2c3cyBhE5wFBG4DXR7_5POcStr0qmWZQVkPrRQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">... I'm still sometimes confused between the
different syntaxes used by join methods:
<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>
</div>
</div>
</blockquote>
<p>It seems fairly consistent to make:<br>
</p>
<p> os.path.join('a', 'b', 'c')</p>
<p>short for:</p>
<p> os.path.sep.join(['a', 'b', 'c'])</p>
<blockquote type="cite"
cite="mid:CAC6Op1-TNV+-2c3cyBhE5wFBG4DXR7_5POcStr0qmWZQVkPrRQ@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<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>
</div>
</div>
</blockquote>
<p>Please, no. This would be un-Pythonic in my view. It makes so
much more sense that str should have a method that takes an
iterable, returning str, than that every iterable should have a
join(str) returning str. Consider you get this kind of thing for
free:<br>
</p>
<p> "-".join(str(i) for i in range(10))</p>
<p>I learned enough Groovy last year to use Gradle and was so
disappointed to find myself having to write:</p>
<p> excludes: exclusions.join(',') // Yes, it's that
way round :o<br>
</p>
<p>Even Java agrees (since 1.8) with Python.<br>
</p>
<pre class="moz-signature" cols="72">Jeff Allen
</pre>
</body>
</html>