Last active
March 26, 2023 21:54
-
-
Save yeaske/ba91afef59d32404a0ca5e95481eceef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__repr__ | __str__ | |
---|---|---|
Provides an unambiguous string representation of an object. | Provides a human-readable string representation of an object. | |
Mainly intended for developers and debugging purposes. | Intended for end-users and display purposes. | |
If not explicitly defined, Python will use the default implementation. | If not explicitly defined, Python will call the __repr__ method as a fallback. | |
Should ideally return a string that, when passed to eval(), would create an object with the same properties. | Focuses on readability and displaying relevant information about the object. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment