[Python-ideas] Arguments to exceptions
Paul Moore
p.f.moore at gmail.com
Thu Jul 6 14:33:58 EDT 2017
On 6 July 2017 at 18:59, Mark E. Haase <mehaase at gmail.com> wrote:
> On Thu, Jul 6, 2017 at 5:58 AM, Paul Moore <p.f.moore at gmail.com> wrote:
>>
>> To use the (already
>>
>> over-used) NameError example, Ken's proposal doesn't include any
>> change to how NameError exceptions are raised to store the name
>> separately on the exception.
>
>
> Maybe I'm misunderstanding you, but the proposal has a clear example of
> raising NameError and getting the name attribute from the exception
> instance:
But no-one manually raises NameError, so Ken's example wouldn't work
with "real" NameErrors. If Ken was intending to present a use case
that did involve manually-raised NameError exceptions, then he needs
to show the context to demonstrate why manually raising NameError
rather than a custom exception (which can obviously work like he
wants) is necessary.
Paul
More information about the Python-ideas
mailing list