In this video course, you’ve learned the difference between official and informal string representations of Python objects. The special method .__repr__() returns the official string representation, which is aimed at programmers as they develop and maintain a program. The special method .__str__() returns the informal string representation, a friendlier format for the program’s user.
Now, you can distinguish between these two representations and know which one to expect in different situations. And if you haven’t been doing this already, you’ll never write another class without defining at least the .__repr__() method to provide the official string representation.
Congratulations, you made it to the end of the course! Make it stick: Mentor AI will check what you’ve got down, help you build something with it, and find your #1 takeaway to share in the discussion.
Or go straight to the discussion section and share your #1 takeaway and how you’ll put your new skills to use.