Personally I prefer an implicit else for the most (roughly 90%) cases. For example, we need to return payments info for some user. In that case if we check all unusual states the code looks much more readable. We have all the unusual checks on the topmost and then we implement safe and much cleaner program logic:
defreturn_payments(user,connection):ifnotuser:raiseUserNotFoundError()ifnotconnection:raiseConnectionError()...# actual _safe_ logic goes here
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Personally I prefer an implicit else for the most (roughly 90%) cases. For example, we need to return payments info for some user. In that case if we check all unusual states the code looks much more readable. We have all the unusual checks on the topmost and then we implement safe and much cleaner program logic: