[Python-Dev] deprecating string module?

Peter Funk pf@artcom-gmbh.de
Wed, 29 May 2002 08:26:57 +0200 (CEST)


Skip Montanaro wrote:
> I know this has been discussed before.  In light of the recent PEP8 update:
>     Avoid the use of the string module; instead use string methods.
>     These are always much faster and share the same API with unicode
>     strings.
> I thought I'd raise it again.
> How about deprecating the string module?  

I'm absolutely against depreceating the string module!  
Instead I suggest to change the cited wording from PEP8 into

    Avoid the use of the string module unless you want to keep
    compatibility with Python 1.5.2; instead use the string methods
    introduced in later releases of Python.  These are always much
    faster and share the same API with unicode strings.

Python 1.5.2 is still very important and even the latest Red Hat
distributions still use it.  Since the bytecode (.pyc) has changed
inbetween, we decided to ship all our Python Software with 1.5.2
and backport useful new library modules from 2.x to 1.5.2 if we want
to use them.  

Of course the edits needed to turn string method calls back into
string module function calls for 1.5.2 are trivial but they are
nevertheless tedious.  Very often the overall performance win of
using string methods will be so negligible, that I tend to believe
that the CPU cycles saved due to this change don't sum up to the
amount of programmer time wasted by editing Python software from
string function calls into string method calls or vice versa.

Regards, Peter
Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260
office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen, Germany)