When is the output of repr useful?
I have been reading about repr in Python. I was wondering what the application of the output of repr is. e.g. class A: pass repr(A) ='<class __main__.A at 0x6f570>' b=A() repr(b) = '<__main__.A instance at 0x74d78>' When would one be interested in '<class __main__.A at 0x6f570>' or '<__main__.A instance at 0x74d78>' ? unutbu Sometimes you have to deal with or present a byte string such as bob2='bob\xf0\xa4\xad\xa2' If you print this out (in Ubuntu) you get In [62]: print(bob2) bob𤭢 which is not very helpful to others trying to understand your byte string. In the comments, John points out that