[Tutor] Finding all the letters in a string?

Kent Johnson kent37 at tds.net
Tue Sep 18 12:45:59 CEST 2007


Luke Paireepinart wrote:
> Remember how people are always saying "don't use the string module 
> unless necessary because string objects have most of the functionality 
> built-in now"
> This is another case of that.

I think this advice is being a little overstated in this thread. The 
string module itself is not deprecated. Many functions in the string 
module are also available as methods of a string. These functions are 
deprecated. You can see a list here:
http://docs.python.org/lib/node42.html

There is nothing wrong with using the constants defined in the string 
module such as string.ascii_letters. Template strings 
(http://docs.python.org/lib/node40.html) were actually *added* to the 
string module in Python 2.4. capwords() and maketrans() are available 
only in the string module, not available as string methods.

Kent


More information about the Tutor mailing list