Hacker News new | ask | show | jobs
by joshkel 619 days ago
Interesting.

The way I was taught Python, you really, really don't want to use bare `except:`, because it catches _everything_: Ctrl-C interruptions, system exit, etc. Instead, you really ought to use `except Exception:` (where `Exception` is the base class for any "normal" runtime error).

So I definitely understand the rationale, but it's hard to say it's worth the pain of backward incompatibility - we have linters, style guides, etc. that can catch this.

2 comments

Yes, I was bitten by it in the past. Still, it'd better be a lint, or at least a very very long deprecation period... like, deprecated and removed in Python 4 or something.
Having your linter catch `except:` is both simpler and cleaner than changing the language.
Deprecating without removing ever seems reasonable
How does deprecation without removal differ from a best practice?

All features of a language end up used, regardless of deprecation state.

I steers people who don't know better away in numerous ways, e.g. most editors with language awareness will give some kind of visual indication like a strike-trough.
absolutely, this should not be done at the language level. the language should not enforce "best practices", that's what the ecosystem is for.