[Python-Dev] doctest improvements
Edward Loper
edloper at gradient.cis.upenn.edu
Mon May 31 20:41:44 EDT 2004
Tim Peters wrote:
> [...] Making a doctest
> reader learn a special "doctest markup language" is A Problem in this case.
> Offhand, I'd be happier with an almost-self-evident (say)
>
> <blank line>
Perhaps you'd be happier with a different value of BLANKLINE_MARKER,
then? E.g. "blank>":
def test():
r"""
A different marker:
>>> print 'a\n\nb'
a
blank>
b
"""
Although this means that you have to indent the doctest quite far.
Perhaps it would be better if I changed the patch so the marker doesn't
need to dedented all the way? E.g.:
def test():
r"""
A different marker:
>>> print 'a\n\nb'
a
<blank line>
b
"""
Another option to consider might be:
def test():
r"""
A different marker:
>>> print 'a\n\nb'
| a
|
| b
"""
I.e., the user can optionally preceed each line with a "|" (or some
other marker), dedented past the prompt, to mark the extent of the
output. I don't think this looks as wysiwyg, though.
-Edward
More information about the Python-Dev
mailing list