[issue33809] Expose `capture_locals` parameter in `traceback` convenience functions

Irit Katriel report at bugs.python.org
Fri Jan 15 06:24:59 EST 2021


Irit Katriel <iritkatriel at yahoo.com> added the comment:

Generally speaking, I don't think it's a good idea to create redundant APIs. If we copy all the params from TracebackException (and it will be all params, why only this one?) that means more code, more tests, more documentation and a higher cognitive load for someone reading the documentation to learn the API.  And the users don't really get anything tangible in return - they can do exactly the same things, maybe with a slightly smaller number of characters.  A good standard library API has a small number of buttons that can be used in combination to get a lot of functionality.

In this particular case, I think it's nice that print_exception() gives novices a simple way to get some basic functionality, and more sophisticated users can go to TracebackException for more options. I agree with you that at the moment it's a bit clumsy, and a print() method would make it more usable. Note that a programmer who understands the different parts of a traceback and wants to tweak its representation is not a novice and should be able to use that with ease.

----------
versions: +Python 3.10 -Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33809>
_______________________________________


More information about the Python-bugs-list mailing list