On May 30, John H Palmieri wrote:
Just for kicks, I counted the number of .py and .pyx files in the Sage library,
and then counted the ones with lines longer than 80 characters in their
docstrings/doctests. 84% of them had such lines.

Thanks, that was my impression, I looked and looked and found tons of long lines and I don't remember one example of a broken output line (that would render ugly but still pass a doctest). Perhaps this could be added to the developer's guide. I started working on vim with the little annoyance of having two different colorcolumns (at 72 and 80) just because of that PEP, but I suspect that no one cares about the different line lenghts (admittedly this is just an unfounded hunch). Best, R.


On Saturday, May 30, 2020 at 9:14:59 AM UTC-7, John H Palmieri wrote:

   Lines should be shorter than 80 characters when possible. If it isn't
   possible because it will cause confusion, break a doctest, make a doctest
   unhelpful, etc., then you can make an exception. There are plenty of
   exceptions in the Sage library already, for example

   [1]https://git.sagemath.org/sage.git/tree/src/sage/homology/
   chain_complex.py#n225

(I just picked a file at random in the Sage library and found an example. I
   would guess that this is typical.)

Ellipses in doctest output should be used for parts of the output that are random or are too long (as in many lines long) to be useful. The details of
   the traceback from an error is a typical use case for this.


   On Saturday, May 30, 2020 at 6:31:34 AM UTC-7, Reimundo Heluani wrote:

       On May 30, Michael Orlitzky wrote:
       >On 5/30/20 8:51 AM, 'Reimundo Heluani' via sage-devel wrote:
       >>
       >> I've looked through the code and found numerous instances of long
       times in
       >> examples and tests blocks. So my question is: is there a policy
       about these
       >> things? My guess is to leave the long lines of output without
       wrapping.
       >>
       >
       >You can usually add parentheses and continue your doctest with a
       "....:"
       >on the next line so that the test retains its meaning and the HTML
       >output remains correct. For example, here's a line that's too long:
       >
>> sage: from mjo.eja.eja_algebra import >> QuaternionMatrixEuclideanJorda
       nAlgebra
       >
       >Instead of forcing a line break with (say) a backslash, you can do
       >
       >  sage: from mjo.eja.eja_algebra import (
       >  ....:     QuaternionMatrixEuclideanJordanAlgebra )
       >
       >The same trick allows you to break sums, products, list
       comprehensions,
       >etc. over multiple lines.
       >
       Thanks, my question is mainly about output strings, how do you break
       them with
       ellipsis?

       R.

       >
       >--
       >You received this message because you are subscribed to the Google
       Groups "sage-devel" group.
>To unsubscribe from this group and stop receiving emails from it, >send
       an email to sage-...@googlegroups.com.
>To view this discussion on the web visit >[2]https://groups.google.com/
       d/msgid/sage-devel/9cbbc443-97e8-deec-d29d-cab5976f3cfd%40orlitzky.com.

--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [3]sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit [4]https://groups.google.com/d/msgid/
sage-devel/9cd7f65c-c9bc-41de-a93b-cbd45639dcf1%40googlegroups.com.

References:

[1] https://git.sagemath.org/sage.git/tree/src/sage/homology/chain_complex.py#n225 [2] https://groups.google.com/d/msgid/sage-devel/9cbbc443-97e8-deec-d29d-cab5976f3cfd%40orlitzky.com
[3] mailto:sage-devel+unsubscr...@googlegroups.com
[4] https://groups.google.com/d/msgid/sage-devel/9cd7f65c-c9bc-41de-a93b-cbd45639dcf1%40googlegroups.com?utm_medium=email&utm_source=footer

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/20200530164750.GA53062%40vertex.

Attachment: signature.asc
Description: PGP signature

Reply via email to