Thank you very much for the explanation.
I believe we are saying almost the same thing. Check the explanation in the article, I explicitly stated that "This is a good practice that could lead to a potential bug as only the expressions directly on the same line as the return gets evaluated."
return balance - amountLine breaks in Python or any language assumes that a new statement has started. Python is a dynamic language, so you can't simply check for compilation errors and end of a statement
;is not used in Python. So in the above codebalanceis returned. The interpreter never reaches- amountwhich never throws a error.To write a statement in multiple lines you use
\character to notify the interpreter that the next line is a part of the current statement.return balance \ # Line below is a part of current statement. - amountAlso floating point is not a bug of python but the underlying platform handling numbers. It happens because it is the way the underlying c platform (on which python works in a sense) handles floating-point numbers. Floating point error is not a bug. Stackoverflow
PS : Apologies. My intensions are not to criticize. Just sharing my opinions.