On 28.06.2017 21:14, Nathaniel Smith wrote:
With PEP 479 there was a different and better way to generate a StopIteration if you wanted one (just 'return'). Here I'm afraid existing projects might actually be relying on the implicit exception leakage in significant numbers :-/
My concern as well.
More generally, my impression is that this is one of the reasons why exceptions have fallen out of favor in more recent languages. They're certainly workable, and python's certainly not going to change now, but they do have these awkward aspects that weren't as clear 20 years ago and that now we have to live with.
I am quite satisfied with the ability of exceptions to expose bugs as fast and clear as possible. I still think we can improve on the catching side a little bit to narrow down the relevant exceptions.
Other than that, I would be interested to hear what system you have in mind. What alternative (borrowed from more recent languages) can you imagine? Checking return values like C or golang? No ability to catch them at all? How to handle bugs in the context of UI applications where a crash in front of the user should be avoided?