8000 MNT: use a property rather than assignment to manage alias · matplotlib/matplotlib@4e677b1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4e677b1

Browse files
committed
MNT: use a property rather than assignment to manage alias
1 parent cff76d1 commit 4e677b1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/matplotlib/figure.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -949,13 +949,16 @@ def clear(self, keep_observers=False):
949949

950950
self.stale = True
951951

952-
# synonym for `clear`.
953-
clf = clear
952+
# synonym for `clear`. We do this with a property to make sure that we get
953+
# a literal alias that correctly behaves for sub-classes (without resorting
954+
# to __subclass_init__ or other meta-programming tools.
955+
@property
956+
def clf(self):
957+
return self.clear
954958

955959
# Note: in the docstring below, the newlines in the examples after the
956960
# calls to legend() allow replacing it with figlegend() to generate the
957961
# docstring of pyplot.figlegend.
958-
959962
@_docstring.dedent_interpd
960963
def legend(self, *args, **kwargs):
961964
"""
@@ -2848,9 +2851,6 @@ def clear(self, keep_observers=False):
28482851
if toolbar is not None:
28492852
toolbar.update()
28502853

2851-
# synonym for `clear`.
2852-
clf = clear
2853-
28542854
@_finalize_rasterization
28552855
@allow_rasterization
28562856
def draw(self, renderer):

0 commit comments

Comments
 (0)
0