On Sun, 16 Apr 2006, Guido van Rossum wrote:

> On 4/16/06, Paul Moore <[EMAIL PROTECTED]> wrote:
>> Personally, my instinct is that having the whole traceback in a
>> doctest is at least as ugly.

You don't need the whole traceback -- e.g.:

"""
     If a URL is supplied, it must have an authority (host:port) component.
     According to RFC 3986, having an authority component means the URL must
     have two slashes after the scheme:

     >>> _parse_proxy('file:/ftp.example.com/')
     Traceback (most recent call last):
     ValueError: proxy URL with no authority: 'file:/ftp.example.com/'
"""

I think the try: ... except FooException: print 'FooException occurred' 
style is uglier and less natural than that, but I guess it's not a big 
deal.


> 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.
[...]

Preferable because depending less on irrelevant details?  I had thought 
that, apart from the issue with module traceback, IGNORE_EXCEPTION_DETAIL 
made that a non-issue in most cases, but perhaps I missed something 
(again).


John

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to