Since Python is dynamically typed, and you do not specify the type of the return value when defining the function, you can return anything with any type that includes None , which is the return value by default (when you do not return anything, the function actually returns None in bottom of function)
Also a simple return equivalent to return None if you want to do this in the middle of a function.
EDIT: forgot to mention: if you use the yield keyword in a function (even if this line is never executed), the story changes, and this is no longer a normal function, this is a generator ...
saeedgnu
source share