Skip to content

Commit db9e631

Browse files
authored
Merge pull request matplotlib#8119 from anntzer/drop-None-container-children
Drop None from Container.get_children().
2 parents 29bff2f + 48c7360 commit db9e631

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/matplotlib/container.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ def set_remove_method(self, f):
3232
self._remove_method = f
3333

3434
def remove(self):
35-
for c in cbook.flatten(self,
36-
scalarp=lambda x: isinstance(x,
37-
martist.Artist)):
35+
for c in cbook.flatten(
36+
self, scalarp=lambda x: isinstance(x, martist.Artist)):
3837
c.remove()
3938

4039
if self._remove_method:
@@ -102,7 +101,7 @@ def pchanged(self):
102101
func(self)
103102

104103
def get_children(self):
105-
return list(cbook.flatten(self))
104+
return [child for child in cbook.flatten(self) if child is not None]
106105

107106

108107
class BarContainer(Container):

0 commit comments

Comments
 (0)