A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-April/063782.html below:

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

[Python-Dev] [Python-checkins] r45321 - in python/trunk: Lib/test/test_traceback.py Lib/traceback.py Misc/NEWS [Python-Dev] [Python-checkins] r45321 - in python/trunk: Lib/test/test_traceback.py Lib/traceback.py Misc/NEWSPaul 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4