deprecated string module issue

G

GrayShark

In my code I have:
from string import lower, upper

When I use pylint on the program I get just one warning:

Uses of a deprecated module 'string'.

Iv'e noted that many if not all string functions are now in _builtin_.
Where are the constants?

Thanks
Steven
 
G

GrayShark

In my code I have:
from string import lower, upper

When I use pylint on the program I get just one warning:

Uses of a deprecated module 'string'.

Iv'e noted that many if not all string functions are now in _builtin_.
Where are the constants?

Thanks
Steven

Sorry, I meant "from string import lowercase, uppercase"

As I was joining these two, I just changed the import to 'letters'

So if the constants are not deprecated, why is the module? Is some
other
state then deprecated needed to describe functions and/or methods
deprecated,
but not whole modules?

It just seems wrong, this all or nothing state.

Steven
 
T

Thomas Jollans

Sorry, I meant "from string import lowercase, uppercase"

As I was joining these two, I just changed the import to 'letters'

So if the constants are not deprecated, why is the module? Is some
other
state then deprecated needed to describe functions and/or methods
deprecated,
but not whole modules?

It's not.

http://docs.python.org/library/string.html

"""The string module contains a number of useful constants and classes,
as well as some deprecated legacy functions that are also available as
methods on strings."""

Maybe it's deprecated in pylint-land, but the docs appear to disagree.
And I'd say it's clear whose authority is higher.

Thomas
 
T

Terry Reedy

Again: the string module is not deprecated. It simply is not.

GrayShark, pylint has a bug. Tell the author that its over-enthusiastic
message mislead you.
 
B

Benjamin Peterson

GrayShark said:
Sorry, I meant "from string import lowercase, uppercase"

Technically, you should use ascii_lowercase and ascii_uppercase, though I don't
know if that's the cause of pylint's complaints.
 
T

Terry Reedy

Thanks for the suggestion. I gave it a quick try. Same 'warning'. No,
using the string module is the issue. Perhaps I'll just ignore it.

And what about the next naive user of pylint? Submitting a bug report to
the author of pylint would take much less time than you have *us* to
spend helping you. Doing so would be a way of thanking us since then, if
pylint were changed, we would not have to answer the same question again
in a year.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,187
Latest member
RosaDemko

Latest Threads

Top