Jan-11-2024, 12:14 PM
(This post was last modified: Jan-11-2024, 12:14 PM by deanhystad.)
Objects have two string representations: __str__ is the pretty one, and __repr__ is the smart one. __str__ is used when you call str() or print() an object. __repr__ is used when you call repr() or when you print an object as part of a collection (list, dictionary, set, tuple).
Have you tried omitting the method to see what happens? What do you think will happen?
Have you tried omitting the method to see what happens? What do you think will happen?