<div dir="ltr"><div><div>On Sun, Dec 30, 2012 at 5:58 PM, MRAB <span dir="ltr"><<a href="mailto:python@mrabarnett.plus.com" target="_blank">python@mrabarnett.plus.com</a>></span> wrote:<br></div></div><div class="gmail_extra">

<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>On 2012-12-30 16:00, Ned Batchelder wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


I don't understand the conflict?  .replace() from sequence does<br>
precisely the same thing as .replace() from bytes if you limit the<br>
arguments to single-byte values.  It seems perfectly natural to me. I<br>
must be missing something.<br>
<br>
</blockquote></div></div>
[snip]<br>
The difference is that for bytes and str it returns the result (they<br>
are immutable after all), but the suggested addition would mutate the<br>
list in-place. In order to be consistent it would have to return the<br>
result instead.</blockquote><div> </div></div></div><div class="gmail_extra"><div><div>I don't think that consistency between str and list is desirable. If .index for example were consistent in str and list it would look like this:</div>

<div><br></div><div>    [9, 8, 7, 6, 5].index([8,7]) # = 1</div></div><div><br></div><div>Also, </div><div>    reversed, sorted (copy)</div><div>    list.reverse, list.sort (in-place)</div><div>From that perspective list.replace working in-place *is* consistent.</div>

<div><br></div><div>However, I can see that this '.replace' might cause more confusion than future code clarity.</div><div><br></div><div>What about .indices though?</div></div></div>