Message264488
On Fri, Apr 29, 2016 at 10:09:46AM +0000, DqASe wrote:
> Added file: http://bugs.python.org/file42649/x.py
Ah, I see! That makes sense now. Thanks.
Why don't you just set the initial state of the lists in the doctests?
That makes much better documentation. Imagine a more complex example
where the function name means nothing to you and the topic is
unfamiliar:
>>> piyo(mylist, hogera=12, fuga=7)
>>> mylist
[0, 2, 4, 6, 14, 16]
But if I show the initial state of the list, not only is the meaning
more obvious (which makes it better documentation and a better test),
but your problem goes away:
>>> mylist = [0, 2, 4, 6, 8, 10, 12, 14, 16]
>>> piyo(mylist, hogera=12, fuga=7)
>>> mylist
[0, 2, 4, 6, 14, 16]
I fear that this suggested feature will encourage poor doctests that
rely on global state rather than local state. |
|
Date |
User |
Action |
Args |
2016-04-29 11:12:06 | steven.daprano | set | recipients:
+ steven.daprano, DqASe |
2016-04-29 11:12:06 | steven.daprano | link | issue26878 messages |
2016-04-29 11:12:05 | steven.daprano | create | |
|