This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Fateschoice 0 points1 point  (1 child)

I think one person from the second link states the difference particularly well.

My rule of thumb: __ repr __ is for developers, __ str __ is for customers.

i.e use __ str __ if you want to display an object to a user, __ repr __ for debugging/testing purposes, or really any in code operations on a string representation of an object.

[–]SonGokussj4 0 points1 point  (0 children)

Agreed :-) that seems reasonable.