-
Notifications
You must be signed in to change notification settings - Fork 51
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
Need fixer for list.sort(cmp=...) #116
Comments
I don't see a straightforward, idiomatic way to replace
|
The I agree that in most cases there will be a simpler and probably more efficient key function than using cmp_to_key(). Where the cmp function is supplied as a lambda, you could try to match a pattern like |
functools.cmp_to_key is only in Python 2.7, and we claim to support Python 2.6. We could make it an opt-in fixer I suppose. |
I think that at least getting warning during processing is a must have. Otherwise the error will popup at run-time when line will be triggered. It may worth to maintain a sane cookbook with explanations why particular problem exists, and how it can be manually adjusted. |
Like Debian linter does - https://lintian.debian.org/tags/out-of-date-standards-version.html |
Python-modernize doesn't generally do warnings, and it certainly doesn't
guarantee that the code will run unmodified on python 3 afterwards. I know
Brett Cannon was working on putting some python 3 compatibility checks into
pylint to complement the fixes in python-modernize.
|
The cookbook would be http://python3porting.com/ -- I believe @brettcannon had plans to update it to recommend python-modernize. |
Unhandled Python 2 code:
The text was updated successfully, but these errors were encountered: