I am trying to understand difference between __str__
and __repr__
and following Difference between __str__ and __repr__ in Python
In the answer it says __repr__
's goal is to be unambiguous, I am confused what that really means. Another answer says: __repr__
: representation of python object usually eval
will convert it back to that object, so I have read that eval
function let execute the python code in it.
Can someone please explain these terms in simple language:
- What is object reconstruction?
- What is
__repr__
? - What is the connection between
eval
and__repr__
?