[Python-Dev] [Python-checkins] r45321 - in python/trunk: Lib/test/test_traceback.py Lib/traceback.py Misc/NEWS (original) (raw)

Guido van Rossum guido at python.org
Sun Apr 16 15:33:45 CEST 2006


On 4/16/06, Paul Moore <p.f.moore at gmail.com> wrote:

Personally, my instinct is that having the whole traceback in a doctest is at least as ugly.

Well, it depends on what you use doctest for. If you use it to write unit tests, the try/except solution is fine, and perhaps preferable.

If you use it as documentation, where doctest is used to ensure that the documentation is accurate, showing a (short) traceback seems to be the logical thing to do. In a sample session where you want to show that a certain exception is raised for a certain combination of erroneous arguments (for example), showing the traceback is much more natural than putting a try/except around the erroneous call.

So one person's ugly is another person's pretty.

-- --Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list