Skip to content

Should ArtistList implement __add__? #19890

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

Closed
anntzer opened this issue Apr 7, 2021 · 1 comment · Fixed by #19902
Closed

Should ArtistList implement __add__? #19890

anntzer opened this issue Apr 7, 2021 · 1 comment · Fixed by #19902
Milestone

Comments

@anntzer
Copy link
Contributor

anntzer commented Apr 7, 2021

Problem

ArtistList (#18216) is great :) but I realized that I had a few places in my old programs where I was doing e.g. ax.lines + ax.images + ..., which now breaks because there's no ArtistList.__add__. Instead one can do [*ax.lines, *ax.images, ...] but perhaps implementing ArtistList.__add__ may help with the transition?

Proposed Solution

Implement ArtistList.__add__ (which should only add ArtistLists and/or lists, and return plain lists). ArtistList.__iadd__ should probably also be implemented as throwing an exception (or emitting a deprecation warning), as direct modification of ArtistLists is currently being deprecated.

Additional context and prior art

N/A

@anntzer anntzer added this to the v3.5.0 milestone Apr 7, 2021
@QuLogic
Copy link
Member

QuLogic commented Apr 8, 2021

ArtistList.__iadd__ should probably also be implemented as throwing an exception (or emitting a deprecation warning), as direct modification of ArtistLists is currently being deprecated.

This already triggers a deprecation warning through ArtistList.insert.

QuLogic added a commit to QuLogic/matplotlib that referenced this issue Apr 8, 2021
QuLogic added a commit to QuLogic/matplotlib that referenced this issue Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants