File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
doc/api/next_api_changes/behavior Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1+ AritistList proxies copy contents on iteration
2+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+ When iterating over the contents of the the dynamically generated proxy lists
5+ for the Artist-type accessors (see :ref: `Behavioural API Changes 3.5 - Axes
6+ children combined`), a copy of the contents is made. This ensure that artists
7+ can safely be added or removed from the Axes while iterating over their children.
8+
9+ This is a departure from the expected behavior of mutable iterable data types
10+ in Python -- iterating over list while mutating it has surprising consequences
11+ and dictionaries will error if they change size during iteration. In this case
12+ because all of the accessors are filtered views of the same underlying list, it
13+ is possible for seemingly unrelated changes, such as removing a Line, to affect
14+ the to affect the iteration over any of the other accessors, we have opted to
15+ make a copy of the relevant children before yielding them to the user.
16+
17+ This change is also consistent with our plan to make these accessors immutable
18+ in Matplotlib 3.7.
You can’t perform that action at this time.
0 commit comments