I ran into something different today. Consider this simple function:
def hi():
return \'hi\'
If I call it in a Python shell,
First of all, its not return
ning, and it's not related to functions. You just have an expression that evaluates to an object (big surprise! everything in Python is an object).
In this case, an interpreter can choose what to display. The interpreter you're using apparently uses __repr__
. If you'd use IPython, you'd see there's a whole protocol, depending on the frontend, determining what will be displayed.