On Wed, Aug 14, 2019 at 11:34 PM Marat Sharafutdinov <[email protected]> wrote: > > The essence of my idea is simple and does not affects compatibility with > existing code: to automatically define a magic attribute of module under the > working name "__exception__" while importing any module. It can be used in > usual way, for example: > >>> try: > ... any_module.anything > ... except any_module.__ exception__: > ... ... > > Here any exception an author of library raises can be handled. This way you > can handle any exception that occurs in the library without even knowing what > exceptions it can raise. > > The important point is that only exceptions raised in library itself are > handled. Those exceptions that can be raised in underlying libraries and so > on through the dependency chain should be handled separately. >
Can you elaborate on either (a) the problem that this is solving, or (b) the intended way this feature would be used? I'm a bit confused here. What kind of exception handling are you looking at where you need to handle all exceptions from one module in the same way, but everything else in a different way? ChrisA _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/MV4U2PPLXTVTZ6ZA4DQ2DNGTKARZCKQC/ Code of Conduct: http://python.org/psf/codeofconduct/
