From 44604ce13c518afab7cfabc75efeaed3a654c406 Mon Sep 17 00:00:00 2001 From: jonchar Date: Sat, 27 Feb 2016 00:17:11 -0500 Subject: [PATCH 1/2] Text class: changed __str__ method to return self._text and added __repr__ method. --- lib/matplotlib/text.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index 65497349b15a..fccbbd0fc67d 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -182,9 +182,12 @@ class Text(Artist): _cached = maxdict(50) - def __str__(self): + def __repr__(self): return "Text(%g,%g,%s)" % (self._x, self._y, repr(self._text)) + def __str__(self): + return self._text + def __init__(self, x=0, y=0, text='', color=None, # defaults to rc params From 472d3cbade5926e0bd313450ab69585d667a774b Mon Sep 17 00:00:00 2001 From: jonchar Date: Sat, 27 Feb 2016 16:25:12 -0500 Subject: [PATCH 2/2] Text class: removed __str__ method in favor of __repr__. --- lib/matplotlib/text.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index fccbbd0fc67d..13c2e4278b45 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -185,9 +185,6 @@ class Text(Artist): def __repr__(self): return "Text(%g,%g,%s)" % (self._x, self._y, repr(self._text)) - def __str__(self): - return self._text - def __init__(self, x=0, y=0, text='', color=None, # defaults to rc params