On Fri, 25 Sep 2020 at 14:15, Chris Angelico <ros...@gmail.com> wrote:

> Why? Do you really think you can enumerate EVERY possible way that
> something might fail?

Rust does a surprisingly good job of that, actually. But the point is
that Python is not Rust, and the infrastructure Rust uses to allow it
to manage code safety is baked into the language core at a very
fundamental level.

Enumerating the exceptions that a piece of code can raise is
impractical and unhelpful in Python. But that may not be immediately
obvious to someone coming from a different language. That's why it's
important to understand Python properly before proposing new features
that work in other languages. (I don't think that's what the OP is
doing here, to be clear, but the discussion is drifting in that
direction, with Rust's Result type having been mentioned).

**In Python**, writing code from the perspective of "what can I handle
at this point" is the right approach. Deferring unexpected exceptions
to your caller is the default behaviour, and results in a clean,
natural style *for Python*. The proposal here is basically in direct
contradiction to that style.

Paul
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/OERGYDEBVCBA67RBZN6EJYMWPPJ4JMVN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to