Skip to content

Custom __str__ vs __repr__ #1847

Answered by willmcgugan
ajwood asked this question in Q&A
Discussion options

You must be logged in to vote

What would you expect printing a list of MyObj to do?

When you print a container like a list, you are invoke pretty printing, which is designed for displaying data structures.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@ajwood
Comment options

@ajwood
Comment options

@ajwood
Comment options

@willmcgugan
Comment options

@ajwood
Comment options

Answer selected by ajwood
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants