>A Byte of Python

The repr function

The repr function is used to obtain a canonical string representation of the object. Backticks (also called conversion or reverse quotes) does the same thing. Note that you will have eval(repr(object)) == object most of the time.

>>> i = 5
>>> `i`
'5'
>>> repr(i)
'5'
>>>
      

Basically, the repr function or the backticks are used to obtain a printable representation of the object. You can control what your objects return for the repr function by defining the __repr__ method in your class.