News for hackers. Stuff that matters.
Re:Python errors as values: Comparing useful patterns from R... by goodoldneon on Thursday November 09, 2023 @12:00PM (#38207571)
> What if the program receives an interrupt signal during the get_user call?

You shouldn't catch interrupt signals regardless of whether you're throwing or returning errors. This is why your error classes should extend Exception and not BaseException. The interrupt errors (e.g. KeyboardInterrupt) extend BaseException

Re:Python errors as values: Comparing useful patterns from R... by js2 on Thursday November 09, 2023 @07:46PM (#38213492)
When writing multi-threaded code, you might want to catch KeyboardInterrupt to cleanly shutdown worker threads. In any case, my point is that you always need to be aware of exceptions in Python. You can't just return them as values and pretend they don't otherwise exist.