Hi again,

sorry, mail editing disorder. I meant to say this:

Stefan Behnel wrote:
> BTW, last time I checked, options were passed into lib2to3 as attributes of
> an object. I find that very inconvenient. A dict or keyword arguments would
> work much better.

And just to give a hint on what I mean here:

> There's two types of doctests, one that is meant as user readable examples and
> one where the doctest module is used for convenience.

An example of the convenience part is that we use doctests as compiler tests
in Cython, for example. The idea is to compile a source file into a C
extension module using Cython and then execute the module docstring in
Python's doctest module to test the extension.

http://hg.cython.org/cython-devel/file/tip/tests/run/

For example, here is a test for unicode strings, which currently uses both the
u'' and b'' prefix and replaces one of them based on the Python version it
runs in.

http://hg.cython.org/cython-devel/file/tip/tests/run/unicodeliterals.pyx

That's simple to do. However, doctests in user documentation are much harder
to write in a portable way, as all that overhead of (e.g.) encoding byte
strings to unicode strings for normalised output comparison is very
distracting for readers, so it would be much better if you could just say
"this is a doctest in Py3 syntax" or "in Py2 syntax", and have doctest do the
rest for you at runtime.

Stefan

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

Reply via email to