On Fri, Aug 03, 2018 at 06:57:40PM -0500, Abe Dillon wrote: > tmp = None > with suppress(AttributeError): > tmp = person.name[0] > initial = tmp > > Then it would solve many of the common use cases for the None-aware > operators proposed in PEP 505
No it would not. The None-aware operators are not about suppressing AttributeError, please stop suggesting that it is. If you want to propose a general exception suppressing mechanism (aside from the existing try...except statement) then propose it as an independent PEP. Even if we had a general purpose exception-suppressing expression, it wouldn't meet the functional requirements for PEP 505. It would do too much, like offering somebody a bulldozer when all we want is a dustpan and broom. > especially if we made it easy to filter out > None-specific errors: > > class NoneError(BaseException): > pass > > class NoneAttributeError(AttributeError, NoneError): > pass They're not None specific. Any object can raise them. -- Steve _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/