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

Paul Moore p.f.moore at gmail.com
Sun Apr 16 15:19:25 CEST 2006


On 4/16/06, John J Lee <jjl at pobox.com> wrote:

OK, I suppose I should have asked "will 2.5's module traceback work with Python 2.4?". I guess the answer is something resembling "no", but of course (?) the question I'm really interested in is "how, without too much effort or ugliness, can people run their doctests on both 2.4 and 2.5"?

I think there was an example earlier - you could change your doctest to not rely on the exact exception by catching it:

>>> try:
...     1/0
... except ZeroDivisionError:
...     print "Divide by zero!"
...
Divide by zero!
>>>

Whether that counts as "too much effort or ugliness", I'm not sure. Personally, my instinct is that having the whole traceback in a doctest is at least as ugly.

Paul.



More information about the Python-Dev mailing list