I have a function which is defined as below,
import pprint
class Test(object):
def __str__(self):
return "at __str__"
def __repr__(self):
return "at __repr__"
x = Test()
print x
pprint.pprint(x)
Output:
at __str__
at __repr__
Questions:
- what "def __str__(self):" representation means.
- Why the first print is printing the first return value where as pprint is returning second return value.
I'm pretty new to python programming, appreciate if you can provide more detailed information on this.