Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I know I'm taking a joke comment WAY too seriously, but... that "else" branch is unreachable, right?


Correct (in a `try ... else` the else branch is executed when the try block reaches the end of the block with no exception, and the return is leaving the block without reaching the end)

(Bonus context for anyone surprised that it is valid code — Python actually allows you to use “else” in more places than you’d expect - `for ... else` is my favourite (do a for loop over a list of things, `break` if you find the thing that you’re looking for, and then the `else` branch will be taken if you don’t find what you’re looking for. Much cleaner than keeping track of a separate i_found_the_thing bool IMO))


Depends on the exception. Maybe the sun wasn't moral.


that's right, and absolutely make sense, as the church meanwhile realized unbaptized babies don't go to limbo but to heaven.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: