Open laurenassour opened 1 month ago
What is a "to string"?
I think @laurenassour is referring to the __str__
"dunder" method on Python objects.
"dunder" (short for double underscore) methods are a convention that Python uses for utility methods found on every Python object. Generally, these methods should not be called directly. When you "convert" an object to a string, what it's really doing is calling the __str__
method on an object to get a string representation
This is a little vague, but specifically what I'm thinking about is when a log message is trying to provide information by logging an object and said object doesn't have a to string, so we end up with something like
We found an issue in <__main__.AProblem object at 0x7fbb3e29ca60>
.