Irit, Guido, Yuri, Nathaniel, (In the interest of visibility, this was also posted to discuss.python.org <https://discuss.python.org/t/accepting-pep-654-exception-groups-and-except/10813> .) After careful consideration and rather lengthy discussion, the Steering Council has decided to accept PEP 654 (Exception Groups and except*) <https://www.python.org/dev/peps/pep-0654/>. We do have two requests, one of which we mentioned before. We’re very pleased with the amount of care and discussion that went into this PEP, and we’re satisfied that it solves a real-world problem in the least disruptive way. We do remain open for further tweaking of the design, incorporating some of Nathaniel’s ideas, or new ones, but we want to move forward with PEP 654’s proposal and let people get hands-on experience with it. To that end, our request is that we get at least one non-toy use of ExceptionGroups somewhere in the standard library (targeted to 3.11, like PEP 654), and preferably get some third-party experimentation with it as well. The other request is that PEP 654 be updated with a reference to Nathaniel’s ideas (a link to the Discourse discussion), outlining why PEP 654 rejects those ideas (it could just be a copy-paste of some of the discussion, just so long as it’s recorded in the PEP). Regarding Nathaniel’s alternative proposal <https://discuss.python.org/t/flat-exception-groups-alternative-to-pep-654>, I want to be clear on the main reason why we’re accepting PEP 654 rather than waiting for a more complete alternative PEP with concrete examples. The SC agrees that exception groups solve a real problem, albeit a relatively rare and low-level one. We don’t think the problem it solves is big enough that it warrants fundamental changes to the language; changes that would affect the way everyone would write code, or that would make learning Python or reasoning about Python code harder. PEP 654 just about squeaks by those criteria: the new syntax is something new to learn about Python, but it’s not something that’s *required *unless consuming an API that uses ExceptionGroups. ExceptionGroups behave like regular exceptions in code that does not expect them, and do not change the behaviour of existing try/except. In code that potentially produces ExceptionGroups (or its documentation, examples, tutorials, etc) there is enough opportunity to document that, show examples of how to use it, explain the implications and refer to documentation about the concept of ExceptionGroups. By contrast, Nathaniel’s proposal that ExceptionGroups affect how *existing *try/except statements behave, fails those criteria. By sheer nature of doing something meaningful (if confusing) in try/except, it would encourage API designs that let ExceptionGroups escape to unsuspecting code. It would introduce subtle bugs in code that -- entirely legitimately -- expects only one except block to be executed, or only executed once. These problems would be very hard to detect since they would only show up if called code could *in practice* raise ExceptionGroups. We don’t consider this a viable design choice. The SC does remain open to proposals to extend PEP 654 (like adding an API to iterate over ExceptionGroups), or change some of the semantics (like flat versus nested ExceptionGroups), and we do not want to discourage discussion on any of this. We do want to move forward with PEP 654 as-is in the meantime, in particular to get practical experience in the standard library. With thanks for all your hard work, For the whole SC, Thomas. -- Thomas Wouters <thomas@python.org> Hi! I'm an email virus! Think twice before sending your email to help me spread!
On Sat, Sep 25, 2021 at 12:06 AM Thomas Wouters <thomas@python.org> wrote:
Irit, Guido, Yuri, Nathaniel,
I do apologise for the typo in your name, Yury... somehow none of us caught it in our proofreading of the response :( I fixed it on Discourse with an edit, but email, alas... -- Thomas Wouters <thomas@python.org> Hi! I'm an email virus! Think twice before sending your email to help me spread!
Ah, that's no problem, both spellings are good. Since I'm replying on Pyhton-dev, I'll quote my Discord response here: "Thank you Thomas and the SC. I’ll start working on incorporating TaskGroups into asyncio in the next few weeks." Thanks, Yury On Fri, Sep 24, 2021 at 3:13 PM, Thomas Wouters <thomas@python.org> wrote:
On Sat, Sep 25, 2021 at 12:06 AM Thomas Wouters <thomas@python.org> wrote:
Irit, Guido, Yuri, Nathaniel,
I do apologise for the typo in your name, Yury... somehow none of us caught it in our proofreading of the response :( I fixed it on Discourse with an edit, but email, alas...
-- Thomas Wouters <thomas@python.org>
Hi! I'm an email virus! Think twice before sending your email to help me spread!
participants (2)
-
Thomas Wouters
-
Yury Selivanov