I have a Python class ElectionData
that stores all data for an election, including a list of ElectionRound
instances that in turn store the vote counts for each round.
For debugging and verbose printing purposes, I would like an option to fully print all of the data within ElectionData
, including the vote counts in each contained ElectionRound
. This printout should be human-readable, formatting the information with newlines.
My understanding is that __repr__()
is for an unambiguous system representation of the instance and __str()__
is for a more concise user representation, but I am not sure if it is meant for large representations.
Given that this "pretty" formatted printout could be quite long, is using __str()__
still advised, or should I create a new method like description()
for this purpose?
Edit:
I have already researched the difference between __str__()
and __repr__()
; this question is about if a long-form printout should use __str__()
or a separate method