TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The Dark Path, Or, What If I Don't Want to Quit My Job?

3 pointsby cruxover 8 years ago

1 comment

wyldfireover 8 years ago
&gt; This is rather absurd and I won’t address it any more than to point out that many ordinary programmers intuitively grasp the basic value of safety and specificity, which is why in Python it is widely considered extremely bad practice to write `except:` or `except Exception:` even though having to specify all of the exception classes we are interested in is arguably a safety that we could override at no loss of expressiveness.<p>It takes me a while to unpack this sentence. So I hope I&#x27;m misunderstanding. I think he&#x27;s saying that we could skip out on specifying the exception classes we&#x27;re interested in without losing expressiveness. Expressiveness aside, this is a huge change in functionality.<p>IMO Python probably should&#x27;ve put some kind of damper on `except:` because it&#x27;s almost never what you want. First off, I&#x27;d call this list of classes ones we&#x27;re &quot;prepared to handle&quot; rather than &quot;interested in.&quot; `except:` states boldly &quot;nah, don&#x27;t propagate this up the stack, I know what to do no matter what happened down there.&quot; Using `except:`&#x2F;`except Exception:` is bad because it will catch &quot;UnboundLocalError&quot;, &quot;IndentationError&quot; and several others that are very-nearly unhandle-able elements of the code&#x27;s design. There exists a sliver of a case for a handler in __main__() or somewhere else that can log something though.<p>If he&#x27;s getting at the point of Bob&#x27;s article regarding static typing and testing, then I don&#x27;t see how Python be anything like how it is today and still have some kind of static evaluation of Exceptions-that-could-come-from-this-call.