this question has answer here:
i stumbled across several python programs written different people , noticed every function had return @ end of it
def function01(): # function # events # here return
i wondering if it's python programming practice include return @ end of functions if not returning (purely way of ending function)
or not needed , nothing different happen in background?
no, not necessary. function returns after last line. there no difference between simple return
, no return
.
def foo(): pass def bar(): pass return f = foo() print(f) b = bar() print(b)
output:
none none