Logged In: YES
user_id=31435
It's intentional that doctest looks for PS1 to identify lines that
begin Python statements, and I'm opposed to changing that.
The docs could be clearer on this point. I don't care that the
Python command-line shell is braindead in starting a line
following a comment with PS2. The IDLE shell, and the
PythonWin shell, are not insane in this respect, and I don't
want doctest to be in the business of guessing intent across
the union of all stupid things all Python shells do. As the docs
say, "In most cases a copy-and-paste of an interactive
console session works fine". "most" < "all", because of goofy
exceptions like this one. doctest has its own rules for
distinguishing among intial lines, continuation lines, and output
lines, and I want to keep them as simple as they are.
In your specific example, change the doctest to use PS1
instead of PS2 on the 'print' line, and it should work fine.
While I'm rejecting this patch, I'd be happy to see a patch to
make the Python command-line shell smarter in this case.
|