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.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com