Hi everyone,
I'm working on #12415 and am revising the methods for continuing lines.
Currently you can continue a line with the standard python ..., which looks
good in standard Python doctests since it has the same length as >>>, but
doesn't look at nice in Sage. After #12415 the doctesting code will
replace "....: " with "..." before passing it on to Python's doctest module.
Sage currently treats a backslash at the end of the line as a continuation
character which is nonstandard but allows us to write large integers that
span multiple lines. For example:
1. Are there any objections to continuing to allow this backslash notation?
2. Are there any opinions on whether we should change the format some
files in sage/tests to use "....: " rather than "..." for line
continuations? The "..." continuations will continue to work so doctests
pass even without this change, but it would make the formatting of the
tests more readable. On the other hand I know that many of the tests come
from published books and there's value in staying exactly the same as the
book.
The new doctesting code at #12415 is almost done. Over the past week I
fixed a bunch of issues and there's only one remaining that I'm aware of: a
segfault that occurs if test/interrupt.pyx is tested, but only if it's not
the first file being tested. Help debugging from someone who's more versed
in Sage's signal handling would be welcome.
David
http://trac.sagemath.org/sage_trac/ticket/12415
On 2012-10-24, David Roe <roed.m...@gmail.com> wrote:
> 1. Are there any objections to continuing to allow this backslash notation?
At least not from me.
> 2. Are there any opinions on whether we should change the format some
> files in sage/tests to use "....: " rather than "..." for line
> continuations?
Since "....: " is shown in interactive sessions if you define something
that spans over several lines, I'd actually appreciate to use "....: "
rather than "...". In that way, one could simply copy-and-paste when
creating a doc test.
However, it would also be nice if doc tests could simply be pasted into
an interactive session.
On Wed, Oct 24, 2012 at 3:45 AM, Simon King <simon.k...@uni-jena.de> wrote:
> Hi David,
> On 2012-10-24, David Roe <roed.m...@gmail.com> wrote:
> > 1. Are there any objections to continuing to allow this backslash
> notation?
> At least not from me.
> > 2. Are there any opinions on whether we should change the format some
> > files in sage/tests to use "....: " rather than "..." for line
> > continuations?
> Since "....: " is shown in interactive sessions if you define something
> that spans over several lines, I'd actually appreciate to use "....: "
> rather than "...". In that way, one could simply copy-and-paste when
> creating a doc test.
> However, it would also be nice if doc tests could simply be pasted into
> an interactive session.
I agree that this would be nice. I recall a discussion from Sage Days 40.5
where Volker was working on upgrading IPython and there was a choice to be
made between being able to paste in doctests and something else, but I
don't recall the details.
David
> On Wed, Oct 24, 2012 at 3:45 AM, Simon King <simon.k...@uni-jena.de
> <mailto:simon.k...@uni-jena.de>> wrote:
> Hi David,
> On 2012-10-24, David Roe <roed.m...@gmail.com
> <mailto:roed.m...@gmail.com>> wrote:
> > 1. Are there any objections to continuing to allow this
> backslash notation?
> At least not from me.
> > 2. Are there any opinions on whether we should change the format
> some
> > files in sage/tests to use "....: " rather than "..." for line
> > continuations?
> Since "....: " is shown in interactive sessions if you define something
> that spans over several lines, I'd actually appreciate to use ".....: "
> rather than "...". In that way, one could simply copy-and-paste when
> creating a doc test.
> However, it would also be nice if doc tests could simply be pasted into
> an interactive session.
> I agree that this would be nice. I recall a discussion from Sage Days
> 40.5 where Volker was working on upgrading IPython and there was a
> choice to be made between being able to paste in doctests and something
> else, but I don't recall the details.
It was probably the tradeoff between automatic indentation and pasting in lines. If you have auto indent, then pasting in lines that end in a : mess up the indentation. IPython says that you should use %cpaste to go into a "paste" mode, which turns off autoindentation, among other things.
By the way, I think we're about finishing up the IPython upgrade at #12719. People are welcome to review it and test it out! I'm particularly curious how it and this ticket interact, since both are changing the doctest framework a bit.
David Roe <roed.m...@gmail.com> writes:
> Hi everyone,
> I'm working on #12415 and am revising the methods for continuing
> lines. Currently you can continue a line with the standard python
> ..., which looks good in standard Python doctests since it has the
> same length as >>>, but doesn't look at nice in Sage. After #12415
> the doctesting code will replace "....: " with "..." before passing
> it on to Python's doctest module.
> Sage currently treats a backslash at the end of the line as a
> continuation character which is nonstandard but allows us to write
> large integers that span multiple lines. For example:
> 1. Are there any objections to continuing to allow this backslash
> notation?
No objection.
> 2. Are there any opinions on whether we should change the format
> some files in sage/tests to use "....: " rather than "..." for line
> continuations? The "..." continuations will continue to work so
> doctests pass even without this change, but it would make the
> formatting of the tests more readable. On the other hand I know that
> many of the tests come from published books and there's value in
> staying exactly the same as the book.
Yes, please change this! The first trac ticket I opened, #10458, was
about changing this :)
> The new doctesting code at #12415 is almost done. Over the past week
> I fixed a bunch of issues and there's only one remaining that I'm
> aware of: a segfault that occurs if test/interrupt.pyx is tested, but
> only if it's not the first file being tested. Help debugging from
> someone who's more versed in Sage's signal handling would be welcome.
> David
> http://trac.sagemath.org/sage_trac/ticket/12415