On Thu, Jul 6, 2017 at 2:56 PM, Steven D'Aprano <[email protected]> wrote:
> > Maybe I'm misunderstanding you, but the proposal has a clear example of
> > raising NameError and getting the name attribute from the exception
> > instance:
> >
> > try:
> > raise NameError(name=name, template="name '{name}' is not
> defined.")
> > except NameError as e:
> > name = e.kwargs['name']
> > msg = str(e)
> > ...
>
> What prevents the programmer from writing this?
>
> raise NameError(nym=s, template="name '{nym}' is not defined.")
>
> Or any other keyword name for that matter. Since the exception class
> accepts arbitrary keyword arguments, we have to expect that it could be
> used with arbitrary keyword arguments.
>
I agree completely with your point here, as well as the overall conclusion
that the proposal to change BaseException is a bad idea. I was merely
replying to [what I perceived as] straw manning of the proposal.
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/