What is the difference between __repr__ and __str__ in practice? #21
Answered
by
lukasmiller3
lukasmiller1
asked this question in
Q&A
-
|
What is the difference between repr and str in practice? |
Beta Was this translation helpful? Give feedback.
Answered by
lukasmiller3
Jan 22, 2026
Replies: 1 comment
-
|
A:repr should return unambiguous representation, ideally valid Python code. str returns human-readable string. If str is not defined, Python falls back to repr. Use repr for debugging, str for user-facing output. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lukasmiller1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A:repr should return unambiguous representation, ideally valid Python code. str returns human-readable string. If str is not defined, Python falls back to repr. Use repr for debugging, str for user-facing output.