[Python-Dev] [Python-checkins] cpython (3.2): zip() returns an iterator, make a list() of it; thanks to Martin from docs@

Andrew Svetlov andrew.svetlov at gmail.com
Sun Aug 12 15:00:54 CEST 2012


Just now doctest-like code blocks in Doc/* are used for two different targets:
1. regular doctests
2. notation for documentation
While former can be tested the later will definitely fail (missing
variables, functions, files etc.)

Also docs contains mixed notation, when, say, function declared as
regular code block than called from doctest (see functools.lru_cache
examples). Doctest obviously failed because it cannot find function.

For now if you will try to run doctest on Doc/**.rst you will get *a
lot* of failures.

I doubt if we will convert all docs to pass doctests, at least quickly.
Also making docs doctest-safe sometimes requires less clean and worse
readable notation.

On Sun, Aug 12, 2012 at 3:40 PM, Chris Jerdonek
<chris.jerdonek at gmail.com> wrote:
> On Sun, Aug 12, 2012 at 1:25 AM, sandro.tosi <python-checkins at python.org> wrote:
>> http://hg.python.org/cpython/rev/233673503217
>> changeset:   78512:233673503217
>> user:        Sandro Tosi <sandro.tosi at gmail.com>
>> date:        Sun Aug 12 10:24:50 2012 +0200
>> summary:
>>   zip() returns an iterator, make a list() of it; thanks to Martin from docs@
>
>> diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
>> -   >>> zip(*matrix)
>> +   >>> list(zip(*matrix))
>>     [(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]
>
> Is there a reason we don't run the doctests in the Doc/ folder's .rst
> files as part of regrtest (e.g. via DocFileSuite), or is that
> something we just haven't gotten around to doing?
>
> --Chris
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/andrew.svetlov%40gmail.com



-- 
Thanks,
Andrew Svetlov


More information about the Python-Dev mailing list