Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
ENH: add a copy method to colormaps#19663
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
timhoffm left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
While I don't want to put acopy()
method on every object, it makes sense here. With this method we make copying simpler and thus promote the needed copying at least for the transition period.
Milestoned for 3.4 - this should have been already introduced with the changes in 3.3. If we don't get it in 3.4 a major purpose ( the easier user-copy workaround in the transition period) is gone.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
Agreed, that we definitely don't want a copy method on everything. But most classes aren't primarily coming from global instances, and hence usually can be made from scratch. Whereas colormaps are probably 99% coming from the global list, so I think we should make it easy to move into user scope. |
…663-on-v3.4.xBackport PR#19663 on branch v3.4.x (ENH: add a copy method to colormaps)
Uh oh!
There was an error while loading.Please reload this page.
PR Summary
Right now we are deprecating access to the global colormaps, but users can only avoid it by doing
newcmap = copy.copy(cmap)
which is a bit heavy-handed. Here we provide a simplecopy
method toColormap
so we can donewcmap = cmap.copy()
.See discussion in#19609,#16991,#18503
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).