ps2, IDLE, and doctest
Paul M
p.magwene at snet.net
Fri Oct 17 15:03:29 EDT 2003
Pythoneers,
[I hope this is the appropriate forum to discuss this now that idlefork
has been folded back into the main python distn]
IDLE doesn't use the ps2 prompt ("..." in the command line interpreter)
because it supports multiline editing. This issue has been discussed
before, for example see Guido's explanation in this thread:
http://mail.python.org/pipermail/idle-dev/2002-February/000863.html
Unfortunately the lack of the ps2 prompt makes IDLE inappropriate for
writing multi-line routines that can be used in doctest readable docstrings:
As an example, doctest want's something like this:
>>> for each in cuppertri:
... if each >= 0.0:
... ct += 1
...
>>>
Whereas IDLE gives this:
>>> for each in cuppertri:
if each >= 0.0:
ct += 1
>>>
Doctest kept failing on text I cut-and-paosted from IDLE and it took me
a good 15 minutes to figure out what was going on.
Has anybody else run into this problem? The "solution" of course is to
revert to the command line when I'm including examples in docstrings,
but then you lose all the convenience of the IDLE environment....
--Paul
More information about the Python-list
mailing list