FAQ
I do not want to write two documentations for a module working both in
Python 2.X and Python 3.X.
To avoid that, I would need the ability to interpret doctests
according to the used Python version.

I mean something like that:

"""
Documentation of the module <mymodule>
-----------------------------------------------------------------

If you are using Python 2.X you can check that
<2.X code> # doctest: <some directive for 2.X>
<2.X output>

whereas if you are using Python 2.X you can check that
<3.X code> # doctest: <some directive for 3.X>
<3.X output>

Is something like that possible? If not, what are the options?
2to3 theoretically can converts the doctests, but in practice I have
seen that the doctests for my decorator module needs some manual
tweaking.

Search Discussions

  • Shashwat Anand at Apr 11, 2010 at 8:58 am

    On Sun, Apr 11, 2010 at 1:59 PM, Michele Simionato wrote:

    I do not want to write two documentations for a module working both in
    Python 2.X and Python 3.X.
    There are modules which work in both 2.x and 3.x but still behave
    differently. How will you handle those ?
    IMHO the way as it is is correct

    To avoid that, I would need the ability to interpret doctests
    according to the used Python version.

    I mean something like that:

    """
    Documentation of the module <mymodule>
    -----------------------------------------------------------------

    If you are using Python 2.X you can check that
    <2.X code> # doctest: <some directive for 2.X>
    <2.X output>

    whereas if you are using Python 2.X you can check that
    <3.X code> # doctest: <some directive for 3.X>
    <3.X output>

    Is something like that possible? If not, what are the options?
    2to3 theoretically can converts the doctests, but in practice I have
    seen that the doctests for my decorator module needs some manual
    tweaking.
    --
    http://mail.python.org/mailman/listinfo/python-list
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/python-list/attachments/20100411/659178ab/attachment.html>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedApr 11, '10 at 8:29a
activeApr 11, '10 at 8:58a
posts2
users2
websitepython.org

People

Translate

site design / logo © 2022 Grokbase