Custom __str__
vs __repr__
#1847
-
I'm trying to add some pretty colors to the console representation of a custom object. The Console Prorotol docs describe how to do exactly that, by defining a I found the Rich Repr Protocol, but that seems to solve a different problem. Is it possible to do what I'm attempting, implement custom methods to replace both |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
What would you expect printing a list of When you print a container like a list, you are invoke pretty printing, which is designed for displaying data structures. |
Beta Was this translation helpful? Give feedback.
What would you expect printing a list of
MyObj
to do?When you print a container like a list, you are invoke pretty printing, which is designed for displaying data structures.