There are several possibilities because the CPython functions that are responsible for the str and repr return are slightly different.
But I guess the primary reason is that str
is a type
(a class) and the str.__new__ method has to call __str__ while repr
can directly go to __repr__
.