Continuing the discussion from Three things for productivity:
I don’t have a strong preference, but my sense is that for many small classes they can be the same or be closely related (one can delegate to the other). In rarer cases where stringification of an object could be multiple lines, I imagine we’d want to have two distinct methods in C++ as well.
I’d love to have someone better versed than me in the the Python conventions for str
and repr
put together a straw-man for how we should define them in general and how they should relate to any C++ stringification methods. It seems like having them present across the stack is something a lot of people want, and it’s not all that difficult.
AFAIK, there’s a relatively strong recommendation for how repr
should behave, but three isn’t one for str
, and it’s never been clear to me what to do with repr
when it isn’t possible to make the string eval to construction.