[Python-ideas] Arguments to exceptions

Paul Moore p.f.moore at gmail.com
Fri Jul 7 04:10:54 EDT 2017


On 7 July 2017 at 04:54, Jeff Walker <jeff.walker00 at yandex.com> wrote:
> Here is an example:
>
>     class NameError(BaseException):
>          pass
>
>     try:
>         raise NameError('welker', db='users', template='{0}: unknown {db}.')
>     except NameError as e:
>         unknown_name = e.args[0]
>         missing_from = e.kwargs('db')
>         print(str(e))
>
> Given this example, please explain why it is you say that the arguments are not
> be stored and are not accessible.

Because the proposal doesn't state that NameError is to be changed,
and the example code isn't real, as it's manually raising a system
exception.

Anyway, I'm tired of this endless debate about what Ken may or may not
have meant. I'm going to bow out now and restrict myself to only
reading and responding to actual proposals.

Paul


More information about the Python-ideas mailing list