Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4e677b1

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

File tree

Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed

‎lib/matplotlib/figure.py

Copy file name to clipboardExpand all lines: lib/matplotlib/figure.py
+6-6Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.