annoying doctest problem

Skip Montanaro skip.montanaro at gmail.com
Mon Jan 12 07:15:42 EST 2015


ISTR that when Tim Peters first implemented first, the typical way you were
expected to get tests into a doc string was to copy from an interactive
session, which would not have this problem.

Also, to Steven's comment about fussiness, it isn't so much that it's
fussy. It's more that it's dumb. I just does a simple string comparison of
the expected and actual outputs. It would be impossible for doctest to know
whether the expected output was something like repr or str output, and thus
safe to exchange single for double (don't forget to escape other embedded
quotes!), or was some sort of user-generated string, perhaps intended to be
text in  another programming language which has different quoting rules
than Python. Therefore, fussy (or dumb) is exactly what you want.

I-said-what-I-meant-ly y'rs,

Skip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150112/740a1d2e/attachment.html>


More information about the Python-list mailing list