What is the difference between dunder str and dunder repr?
Object-oriented programming
Audio flashcard · 0:17Nortren·
What is the difference between dunder str and dunder repr?
0:17
Dunder repr returns an unambiguous string representation, ideally one that could recreate the object. Dunder str returns a user-friendly string for display. The repr is used by interactive prompts and the repr function; the str is used by print and the str function. If only repr is defined, it is used as a fallback for str.
docs.python.org