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

remove 'from past.builtins import cmp' #493

Closed
Anthchirp opened this issue Jul 7, 2020 · 0 comments · Fixed by #498
Closed

remove 'from past.builtins import cmp' #493

Anthchirp opened this issue Jul 7, 2020 · 0 comments · Fixed by #498
Labels
housekeeping Things which would make cctbx tidier - and easier to understand for regular Python programmers

Comments

@Anthchirp
Copy link
Member

The cmp function is gone. Importing it from past (which is part of the future package) is causing deprecation warnings all over the place due to PythonCharmers/python-future#551. The imp module will be removed in Python 3.10.
Instances where cmp are used should be rewritten and the cmp import removed.

This is also -as far as I can tell- the only remaining* reason for the future package dependency, which could then potentially be dropped. This would be a good thing as the future package is a bit special.

(* There are two range imports from past in prime, which I'll address separately.)

@Anthchirp Anthchirp added the housekeeping Things which would make cctbx tidier - and easier to understand for regular Python programmers label Jul 7, 2020
Anthchirp added a commit that referenced this issue Jul 7, 2020
Use plain 'range' when in a context where an iterator is sufficient,
and explicitly convert to a list otherwise.

Remove one unnecessary intermediate list construction in a 'max()' call,
where an iterator is sufficient.

(cf. #493)
Anthchirp added a commit that referenced this issue Jul 7, 2020
Use plain 'range' when in a context where an iterator is sufficient,
and explicitly convert to a list otherwise.

Remove one unnecessary intermediate list construction in a 'max()' call,
where an iterator is sufficient.

(cf. #493)
Anthchirp added a commit that referenced this issue Jul 8, 2020
There are no hooks installed anywhere in cctbx_project.
This should not be called at all.
Anthchirp added a commit that referenced this issue Aug 4, 2020
* Replace past.builtins.cmp with libtbx.math_utils.cmp
* Replace cmp() with operator.*getter where possible

Fixes #493
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Things which would make cctbx tidier - and easier to understand for regular Python programmers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant