[Python-ideas] Re: Exception handling in objects

2019-08-14 Thread Marat Sharafutdinov
Sorry, the code was lost. I bring it again: try: any_module.anything except any_module.__ exception__: ... try: any_function() except any_function.__ exception__: ... try: AnyClass.anything except AnyClass.__ exception__: ... __

[Python-ideas] Exception handling in objects

2019-08-14 Thread Marat Sharafutdinov
While using any library there is a need to handle exceptions it raises. In ideal conditions author of library defines base exception and builds hierarchy of exceptions based on it. Moreover, all exceptions a library raises (including those that do not inherit its base exception) are documented a