Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The string module isn't really deprecated, just parts of it. #1993

Closed
smontanaro opened this issue Apr 4, 2018 · 2 comments
Closed

The string module isn't really deprecated, just parts of it. #1993

smontanaro opened this issue Apr 4, 2018 · 2 comments

Comments

@smontanaro
Copy link

​Pylint has been complaining about the string module being deprecated for about as long as I can remember. I've seen no indication that it will ever go away completely. It's certainly still the only place to get a number of useful string constants (ascii_letters, digits, punctuation, ...). A bunch of string functions were dumped in the 2-to-3 change. If pylint is going to complain about the string module, I would suggest:

  • In Python 2, it only complain about names which are no longer present in the Python 3 version:

['atof', 'atof_error', 'atoi', 'atoi_error', 'atol', 'atol_error', 'capitalize', 'center', 'count', 'expandtabs', 'find', 'index', 'index_error', 'join', 'joinfields', 'letters', 'ljust', 'lower', 'lowercase', 'lstrip', 'maketrans', 'replace', 'rfind', 'rindex', 'rjust', 'rsplit', 'rstrip', 'split', 'splitfields', 'strip', 'swapcase', 'translate', 'upper', 'uppercase', 'zfill']

(This would be a useful addition to the Python 2 version before dropping support altogether.)

​* In Python 3, disable the warning about string module deprecation altogether.​ It ain't broken. There's nothing to fix. :-)

@PCManticore
Copy link
Contributor

Thanks for the issue @smontanaro ! If I'm not mistaken, we don't warn about string being deprecated for a couple of releases now. Are you using the latest 1.8 release and still have this issue?
Regarding complaining about those names in the porting checker, that's a great idea and we already do that: https://github.com/PyCQA/pylint/blob/e0aafa646a6aaf90603e7d595e9df922c27e3228/pylint/checkers/python3.py#L551. But we were missing a couple of these members, so I added them in 647b9f0

@smontanaro
Copy link
Author

Claudiu,

You were correct that I wasn't using the latest version of pylint. I updated from 1.7.4 to 1.8.3, but I still received the same complaint. I didn't get the warning message on my home computer, and was scratching my head for a long while about why I kept getting that message on my work computer. Then I found a list of deprecated modules in my ~/.pylintrc dating from 2016. I imagine that is the product of a run with --generate-rcfile. Who knows what version of pylint I had installed at that time...

So, mea culpa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants