INADA Naoki <songofaca...@gmail.com> added the comment:

> https://github.com/search?q=%22except+TemplateError%22&type=Code

For example, I found flask_mako's TemplateException in this search result.

Strictly speaking, this is not base exception class.  It is wraps exception 
during template rendering.  But "why this class is useful?" is very similar to 
base exception class.

It provides better traceback for mako template.  They use this class for 
"particular reason", not because it's generally recommended practice.

And this "particular reason" shouldn't be in Python tutorial, clearly.

---

If we really need exception class hierarchy in tutorial, I think OSError is the 
best example.  When opening a file, `except OSError:` is much better than 
`except (PermissionError, FileNotFound, ...)`.  It's the most clear example 
when common base class for some distinct exceptions is useful.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34538>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to