Warning: Some posts on this platform may contain adult material intended for mature audiences only. Viewer discretion is advised. By clicking ‘Continue’, you confirm that you are 18 years or older and consent to viewing explicit content.
More accurately it should look something like this:
# Load sys library for exiting with status code
import sys
def sayHelloWorld(outPhrase: str="Hello World"):
# Main function, print a phrase and return NoneType
print(outPhrase)
return None
if __name__=="__main__":
# Provide output and exit cleanly when run from shell
sayHelloWorld()
sys.exit(0)
else:
# Exit with rc!=0 when not run from shell
sys.exit(1)
This is bad practice.
More accurately it should look something like this:
Fellow pythonistas, how can I make this code more pythonic?