gmpy 1.0 for python 2.4 alpha 2 Windows-packaged

Alex Martelli aleaxit at yahoo.com
Sun Sep 5 16:26:28 EDT 2004


Tim Peters <tim.peters at gmail.com> wrote:

> IGNORE_EXCEPTION_DETAIL directive.  Then, e.g., this doctest passes
> under 2.3.4 and 2.2.3, and will also pass in 2.4:
> 
> >>> (1, 2)[3] = 'moo' #doctest: +IGNORE_EXCEPTION_DETAIL
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: object doesn't support item assignment
> 
> Since doctest directives didn't exist before 2.4, earlier Pythons view
> them as comments, and insist on exact match.  2.4 will still insist on
> seeing a TypeError, but won't care that "doesn't" has changed to "does

GREAT solution!

> not" (or, for that matter, won't care if the actual detail is
> "Congratulations, Anna and Alex!").

Heh -- thanks!


> After Pythons prior to 2.4 become uninteresting, a less forgiving test
> can be gotten via, e.g.,
> 
> >>> (1, 2)[3] = 'moo' #doctest: +ELLISPSIS

Wow -- typo-tolerant, too?-)

> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: object does... support item assignment

Right, unless 2.5 changes the error text to "objects of type tuple do
not support item assignment" or some other clarificatory rewording, of
course:-).  In practice, my doctests that are meant to survive across
Python releases will become heavy users of IGNORE_EXCEPTION_DETAIL!-)


Alex



More information about the Python-list mailing list