Hi,<br><br>My question is more about style/timing than anything else.<br><br>In my program I&#39;m taking a word and generating &quot;blanks&quot; in that word. For example, the word cat could generate:<br>_at<br>c_t<br>ca_<br>

<br>I have two different ways I can put _ in the word:<br>word = &#39;cat&#39;<br><br>&#39;&#39;.join(list(word)[1] = &#39;_&#39;)<br><br>and<br><br># I&#39;m not using a constant, but randomly generating where the blank appears<br>

word[:1] + &#39;_&#39; + word[1+1:]<br><br>So, when I use the timeit module I get these results:<br><br>In [78]: timeit.Timer(&quot;&#39;&#39;.join(list(&#39;foo&#39;))&quot;).timeit()<br>Out[78]: 2.9940109252929688<br><br clear="all">

In [80]: timeit.Timer(&quot;&#39;foo&#39;[:2]+&#39;_&#39;+&#39;foo&#39;[2+1:]&quot;).timeit()<br>Out[80]: 0.63733291625976562<br><br>Quite a significant difference.<br><br>So my question(s): Which method should I use/is more pythonic? Which method do you/have you used? And the ubiquitous &#39;Why?&#39;<br>

<br>Normally I would lean towards the first method because reassigning a value in a list seems more natural than string concatenation. In this particular application I&#39;m not exactly worried about performance - on even an archaic computer I don&#39;t think one would notice.<br>

<br>TIA for your input,<br>Wayne<br>-- <br>To be considered stupid and to be told so is more painful than being called gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness, every vice, has found its defenders, its rhetoric, its ennoblement and exaltation, but stupidity hasn’t. - Primo Levi<br>