What is the difference between __str__ and __repr__ in Python?
Correct answer
C. __str__ is user-friendly; __repr__ is unambiguous for developers
5 views
C. __str__ is user-friendly; __repr__ is unambiguous for developers
5 views
__str__ is used by print() and str(); __repr__ by repr() and the debugger.
Asked in: Python Interview OOP
https://docs.python.org/3/tutorial/classes.htmlNot sure why the answer is C? Ask here and get an explanation.