If I have a function that does not need to return a variable, is it considered better coding practice to close the function like this:
def foo():
"""Code"""
return
# More code
or like this?
def bar():
"""Code"""
# More code
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’d only use bare return for an early exit from the function. At the end of a function it leaves me wondering if you meant to return something and forgot to finish.