[Python-Dev] Maintenance burden of str.swapcase

Antoine Pitrou solipsis at pitrou.net
Wed Sep 7 03:07:58 CEST 2011

On Wed, 7 Sep 2011 10:47:16 +1000
Nick Coghlan <ncoghlan at gmail.com> wrote:
> However, a big +1 for deprecation in the case of bytes and bytearray.
> That's nothing to do with the maintenance burden though, it's to do
> with the semantic confusion between binary data and ASCII-encoded text
> implied by the retention of methods like upper(), lower() and
> swapcase().

A big -1 on that.
Bytes objects are often used for partly ASCII strings, not arbitrary
"arrays of bytes". And making indexing of bytes objects return ints was
IMHO a mistake.

Besides, if you want an array of ints, there's already array.array()
with your typecode of choice. Not sure why other types should conform.



More information about the Python-Dev mailing list