deprecated string module issue

Stephen Hansen me+list/python at ixokai.io
Fri Jun 25 18:37:13 EDT 2010


Uhh...

On Fri, Jun 25, 2010 at 2:31 PM, GrayShark <howe.steven at gmail.com> wrote:

> As to your comment about Logilab's pylint. I'v seen a ticket similar to
> this from three months back. I assume they're not fixing it because if
> you review 'string' via pydoc you'd read this:
>
> ---------------------------------------
> Help on module string:
>
> NAME
>    string - A collection of string operations (most are no longer used).
>
> FILE
>    /usr/lib64/python2.6/string.py
>
> DESCRIPTION
>    Warning: most of the code you see here isn't normally used nowadays.
>    Beginning with Python 1.6, many of these functions are implemented as
>    methods on the standard string object. They used to be implemented by
>    a built-in module called strop, but strop is now obsolete itself.
>

What is this supposed to demonstrate? That is perfectly accurate. It says,
_most_of_the_code_ here isn't used. The functions, as we have said, are
deprecated-- as they have been moved to the string objects directly.

The module has *not* been deprecated. Nothing in that quote even *implies*
deprecation of the module, the constants, nor any of the code which is there
that *hasn't* been deprecated -- namely, formatter instances and related
functions these days.

Not the 1.6. Seems some serious work went into putting the 'string's
> functionality into _builtin_.
>

No, the string functions were moved to methods of the string type.


> I've seen many 'deprecated' warnings when programming in PyGTK, as
> modules get replaced or functionality changes. I've always assumed it
> means that the module will be removed at some future date. An advisory to
> programmers and users.
>

Yes, that is precisely what that means. And as we have said repeatedly: many
of the *functions* previously contained in the string module were
deprecated.

The string module was not.

The functions were slated for removal. They were prominently documented as
such so when the removal happened (years later), people were prepared.

/The string module itself, its constants, and other code that was NOT moved
into string methods, was *never* deprecated/.

You might note what 'deprecated' means. http://www.thefreedictionary.com/
> deprecated
> tr.v. de·pre·cat·ed, de·pre·cat·ing, de·pre·cates
> 1. To express disapproval of; deplore.
> 2. To belittle; depreciate.
> 3. Computer Science To mark (a component of a software standard) as
> obsolete to warn against its use in the future so that it may be phased
> out.
> -----------------------------------------------
>
> Not the third definition. It applies here. I was inquiring about what
> other module I should be using instead, having grep'ped my way through
>        /usr/lib64/python2.6/*.py
>

... We all know.

I know. Terry knows. Guido knows. Logilab knows, they just appear to be a
little bit confused about what is and isn't deprecated in this case.

Again: many of the functions in the string module were deprecated. Only
those specific functions. The rest was not


> for a replacement.
>

You should continue to use the string module, as it is not deprecated. There
is no replacement. The string module will be there forever. And probably
grow too, a little bit.

If you are using any of the functions that used to be in that module, but
are now methods on the string class directly, you should use those on the
string objects instead. The "join" method which used to be in that module is
now a method on sequence types.


> Nor a naive user here. Been programming/using python since 2000


Then I really don't understand the difficulty here in understanding the
difference between a deprecated module, and a module that contains a number
of deprecated things (and some not deprecated too)

Seriously, go look at -- http://docs.python.org/library/string.html

Scroll 2/3rds of the way down to 7.1.6.

Everything below that line is deprecated. Its all gone in Python 3.

Everything above that line is *not* deprecated. It's sticking around.

--S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100625/a08b5e01/attachment-0001.html>


More information about the Python-list mailing list