Mar-04-2018, 06:24 AM
(This post was last modified: Mar-04-2018, 06:24 AM by Gribouillis.)
(Mar-04-2018, 04:45 AM)Robo_Pi Wrote: I can't imagine that it hurts anything to leave that redundant return in the code?A
main()
function is not special in a python program, it is an ordinary function. A program doesn't need a main function. When there is no return statement in a function, it returns None
(if it ever returns). It means that a return statement is never necessary. In your case, the return statement is useless because it is never executed.The return value of the main function is not the same thing as the program's exit status (because main() is not special) unless you call
sys.exit(main())
as wavic does. The program should exit with value 0 to indicate success.