<div dir="ltr"><div>I'd like to suggest what I think would be a simple addition to `def` and `class` blocks. I don't know if calling those "Assignment Blocks" is accurate, but I just mean to refer to block syntaxes that assign to a name. Anyway, I propose a combined return-def structure, and optionally also allowing a return-class version. Omitting the name would be allowable, as well.<br></div><div><br></div><div>This would only apply to a `def` or `class` statement made as the last part of the function body, of course.</div><div><br></div><div>def ignore_exc(exc_type):</div><div> return def (func):</div><div> @wraps(func)<br></div><div> return def (*args, **kwargs):</div><div> try:</div><div>
return func(*args, **kwargs)</div><div>
except exc_type:</div><div>
pass</div><div><br></div><div>Thanks for considering and for any comments, thoughts, or feedback on the idea!<br></div></div>