[Python-ideas] doctest

Devin Jeanpierre jeanpierreda at gmail.com
Fri Mar 2 19:24:21 CET 2012

On Fri, Mar 2, 2012 at 1:14 PM, Guido van Rossum <guido at python.org> wrote:
>> https://bitbucket.org/devin.jeanpierre/doctest2/src/e084a682ccbc/doctest2/constants.py#cl-122
> It's not a solution. It's a hack that only works in the simplest cases

The simplest cases are also the most common, IME. But yes, I'd like to
expand it to work in a few more cases and be less insane (I'd rather
not interpret printed output as Python code).

> -- it requires the output to look like a Python expression (that can
> be evaluated in a limited environment). What if the output were
> something like
> <Future for 'foo' returning {1: 'blah', 2: 'booh'}>
> ??? There's a dict in there but the whole thing is not parseable.

Yeah. I don't know of any solution to that either. Even if pure-python
code generates that repr, it isn't possible to even replace the repr
with a sorted dict-repr in any sane way, because %r doesn't defer to
repr. It's just an intractible case. Nothing at all mentioned in this
thread would work there.

And I never called it easy, by the way.

-- Devin

More information about the Python-ideas mailing list