[Python-ideas] proposed methods: list.replace / list.indices

Random832 random832 at fastmail.us
Mon Dec 31 06:38:57 CET 2012


On 12/30/2012 10:47 PM, Nick Coghlan wrote:
>
> The problem is bytearray, not bytes and str.
>
> bytearray is a builtin mutable sequence with a non-destructive 
> replace() method. It doesn't matter that this is almost certainly just 
> a mistake due to its immutable bytes heritage, the presence of that 
> method is enough to categorically rule out the idea of adding a 
> destructive replace() method to mutable sequences in general.
>
All this discussion is, of course, before getting into the fact that 
string, bytes, and bytearray .replace() methods all work on subsequences 
rather than elements.



More information about the Python-ideas mailing list