[Python-Dev] sWAPcASE Was: transform() and untransform() methods, and the codec registry (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Fri Dec 10 00:29:30 CET 2010


On Thu, 09 Dec 2010 18:10:38 -0500 Eric Smith <eric at trueblade.com> wrote:

On 12/9/2010 5:54 PM, Raymond Hettinger wrote: > It would make me happy if we could agree to kill or at least mortally wound > str.swapcase(). I did some research on what it is go for and found > that it is a vestige of an old word processor command to handle > the case where a user accidentally left the caps lock key turned-on. > AFAICT using Google's code search, it has nearly zero value for > Python scripts. It does have a cost however, the code search turned-up > many cases where people were writing string like objects and included > swapcase() just so they could match the built-in API. > > It's time for swapcase() to go the way of the dinosaurs.

+1, assuming the normal deprecation process. If we're looking to reduce the number of methods on str, I wouldn't mind seeing center() and zfill() also go away, since they're trivially replaced by format().

Well, it's only trivial when you know format()'s wicked mini-language by heart :/ center() is easy and obvious. zfill() is arguably a bit too specialized.

Regards

Antoine.



More information about the Python-Dev mailing list