[Python-Dev] Maintenance burden of str.swapcase

Stephen J. Turnbull stephen at xemacs.org
Wed Sep 7 03:53:27 CEST 2011


Nick Coghlan writes:

 > 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().

[...]

 > These are all text operations, not something you do with binary data.

"Yea, Brother, Amen!"  I like the taste of this Kool-Aid.  But....

 > The case-related methods, though, have no place in sane wire
 > protocol handling.

RFC 822 headers are a somewhat insane but venerable (isn't that true
of anything that's reached age 350 in dog-years?), and venerated,
counterexample.  Specifically, field names are case-insensitive (RFC
5322, section 1.2.2).  I'll bet you can find plenty of others if you
look.  You can call that "text" and say it should be processed in
Unicode, if you like, but you're not even going to convince me (and as
I say, I like the Kool-Aid).  Specifically, SMTP processes can (and
even MUST, under some circumstances IIRC) manipulate the RFC 822 header.

Sorry, Nick, no can do.

-1


More information about the Python-Dev mailing list