2 ms·
Python's exception system isn't bad. It's way ahead of Java's or C++ exceptions. The gyrations people go through in Go or Rust to handle errors are far worse. T
by Animats 7y ago
Python's exception system isn't bad. It's way ahead of Java's or C++ exceptions. The gyrations people go through in Go or Rust to handle errors are far worse. The exception hierarchy lets you capture an exception further up the tree to subsume all the more detailed exceptions. (Although the new exception hierarchy in 3.x is worse than the old one. In 2.x, "EnvironmentError" was the parent of all exceptions which represented problems outside the program, including the HTTP errors.[1] That seems to have been lost in 3.x).
I think StopIteration is being removed. That was a a bad idea.
- bakery2k 7y agoI haven't seen anything about `StopIteration` being removed? In fact, the Python developers recently doubled-down on the design by introducing `StopAsyncIteration`.
- brylie 7y agoPEP 479 might be what GP was referring to: https://www.python.org/dev/peps/pep-0479/ https://www.python.org/dev/peps/pep-0479/ PEP 479 is specifically related to generators: > If a StopIteration is about to bubble out of a generator frame, it is replaced with RuntimeError, which causes the next() call (which invoked the generator) to fail, passing that exception out. From then on it's just like any old exception.