Hacker News new | ask | show | jobs
by hfhdjdks 1101 days ago
It's not what you were asking for (class that can't be subclassed), but `typing` has an `assert_never` to check exhaustiveness:

https://typing.readthedocs.io/en/latest/source/unreachable.h...

1 comments

Thanks for this trick for exhaustiveness checking, I've just been putting

  assert False, "This is unreachable."
in my code until now.