Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23276

python: return, return None, and no return at all -- is there any difference?

$
0
0

Consider these three functions:

def my_func1():  print "Hello World"  return Nonedef my_func2():  print "Hello World"  returndef my_func3():  print "Hello World"

They all appear to return None. Are there any differences between how the returned value of these functions behave? Are there any reasons to prefer one versus the other?


See also: is it possible to not return anything from a function in python?


Viewing all articles
Browse latest Browse all 23276

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>