I have defined a class foo and a function foo.__str__()
. If x is an instance of foo, x.__str__()
returns a string representation of x. I have checked this on examples and it seems to work as I wish it to.
My question is, how to I now define foo.print()
. Am I supposed to use __str__
or, annoyingly, repeat the code of __str__
?