I ran into something different today. Consider this simple function:
def hi():
return \'hi\'
If I call it in a Python shell,
The interactive interpreter will print whatever is returned by the expression you type and execute, as a way to make testing and debugging convenient.
>>> 5
5
>>> 42
42
>>> 'hello'
'hello'
>>> (lambda : 'hello')()
'hello'
>>> def f():
... print 'this is printed'
... return 'this is returned, and printed by the interpreter'
...
>>> f()
this is printed
'this is returned, and printed by the interpreter'
>>> None
>>>
See Read–eval–print loop on Wikipedia for more information about this.