This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Aaron Hall
Recipients Aaron Hall, docs@python
Date 2019-05-15.17:04:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557939885.98.0.0482711491834.issue36927@roundup.psfhosted.org>
In-reply-to
Content
I've written three (or more) answers on Stack Overflow about how to use the functions in the traceback module, and I code Python all day long.

Embarrassing confession: I just recommended the wrong traceback function in email to fix the incorrect usage of another of these functions after pulling up the docs because. I corrected myself before anyone else could correct me, but I find these docstrings incredibly frustrating and problematic.

May I please give them a little more verbiage about their return values?

e.g.:

def format_tb(tb, limit=None):
    """A shorthand for 'format_list(extract_tb(tb, limit))'."""
    return extract_tb(tb, limit=limit).format()

should be:

def format_tb(tb, limit=None):
    """A shorthand for 'format_list(extract_tb(tb, limit))',
    which returns a list of strings ready for printing'.
    """
    return extract_tb(tb, limit=limit).format()


In fact, perhaps the "shorthand" part is an implementation detail that may not even be correct (it doesn't immediately seem to be) and should be removed.
History
Date User Action Args
2019-05-15 17:04:45Aaron Hallsetrecipients: + Aaron Hall, docs@python
2019-05-15 17:04:45Aaron Hallsetmessageid: <1557939885.98.0.0482711491834.issue36927@roundup.psfhosted.org>
2019-05-15 17:04:45Aaron Halllinkissue36927 messages
2019-05-15 17:04:45Aaron Hallcreate