Skip to content

return _text property as __repr__ for Text class #6042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks
DSLituiev opened this issue Feb 22, 2016 · 2 comments
Closed
2 tasks

return _text property as __repr__ for Text class #6042

DSLituiev opened this issue Feb 22, 2016 · 2 comments
Labels
Difficulty: Easy https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues New feature
Milestone

Comments

@DSLituiev
Copy link

now print(text) returns something like:

 <matplotlib.text.Text at 0x7f7d0cfdf0f0>

suggestion: return the _text property in __repr__()


  • Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)
{'dirty': False,
 'error': None,
 'full-revisionid': 'c0728d23ca5adbff6b79cda3153d0d36bff12c55',
 'version': '1.5.1+1304.gc0728d2'}

Python3.4
Ubuntu 14
  • How did you install Matplotlib and Python (pip, anaconda, from source ...)

    pip from git

@jenshnielsen jenshnielsen added this to the 2.1 (next point release) milestone Feb 22, 2016
@tacaswell tacaswell added the Difficulty: Easy https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues label Feb 22, 2016
@souravsingh
Copy link
Contributor

I would like to work on the issue

@afvincent
Copy link
Contributor

Closing this issue as the new behavior since #6068 is

from matplotlib.text import Text

txt = Text(0, 0, 'Here comes the text!')
print(txt) # returns "Text(0,0,u'Here comes the text!')"

which somehow addresses the problem.

Feel free to reopen this issue if the original idea of doing

from matplotlib.text import Text
Text.__str__ = lambda self: self._text

txt = Text(0, 0, 'Here comes the text!')
print(txt) # returns "Here comes the text!"

is really the wished behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: Easy https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues New feature
Projects
None yet
Development

No branches or pull requests

5 participants