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(). >>> '3'.zfill(10) '0000000003' >>> format('3', '>010') '0000000003' >>> '3'.center(10) ' 3 ' >>> format('3', '^10') ' 3 ' >>> '3'.center(10, '-') '----3-----' >>> format('3', '-^10') '----3-----' Although I'll grant this the case for the demise of center() and zfill() isn't as strong as for swapcase(). It's truly useless. Eric.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4