Skip to content

Commit 501cd51

Browse files
committed
Use list comprehension instead of filter
1 parent e4dadb6 commit 501cd51

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/matplotlib/widgets.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,16 +1844,13 @@ def _get_animated_artists(self):
18441844
Convenience method to get all animated artists of a figure, except
18451845
those already present in self.artists.
18461846
"""
1847-
axes = self.ax.get_figure().get_axes()
1848-
animated_artists = tuple()
1849-
for ax in axes:
1847+
animated_artists = []
1848+
for ax in self.ax.get_figure().get_axes():
18501849
# Make sure we don't get the artists already in self.artists
1851-
artists = filter(
1852-
lambda a: a.get_animated() and a not in self.artists,
1853-
ax.get_children()
1854-
)
1855-
animated_artists += tuple(sorted(artists, key=lambda a: a.zorder))
1856-
return animated_artists
1850+
l = [a for a in ax.get_children()
1851+
if (a.get_animated() and a not in self.artists)]
1852+
animated_artists.extend(sorted(l, key=lambda a: a.zorder))
1853+
return tuple(animated_artists)
18571854

18581855
def update_background(self, event):
18591856
"""Force an update of the background."""

0 commit comments

Comments
 (0)