[Python-Dev] Re: doctest improvements
tjreedy at udel.edu
Tue Jun 1 10:52:48 EDT 2004
"Edward Loper" <edloper at gradient.cis.upenn.edu> wrote in message
news:40BBF4C4.2090204 at gradient.cis.upenn.edu...
> Tim Peters wrote:
> > That's more what I had in mind, but if the marker is changed to
> > wordy instead of "a magic character", I don't think the dedent trick is
> > much value anymore:
> > r"""
> > A different marker:
> > >>> print 'a\n\nb'
> > a
> > <blank line>
> > b
> > """
> > Then when the expected output is (exactly) "<blank line>", doctest
> > accept "<blank line>", or a line with nothing other than whitespace, as
> > match. I can't get upset by that bit of ambiguity.
> I had ruled this out because I assumed that any change I made had to
> maintain backward compatibility. But if this (minor) incompatibility is
> acceptable, then let me know and I'll write up a patch to implement it.
To me as a potential user, '<blank line>' is the uniquely obvious marker
for a blank line. The ambiguity is fine; having it uniquely not match
itself and therefore needing a special case escape mechanism would be
worse. I think the explanation "<blank line> matches a blank line as well
as itself" might be sufficient.
Terry J. Reedy
More information about the Python-Dev