Hi all, I forgot to mention this earlier. I think PR 2344 (https://github.com/sympy/sympy/pull/2344) is ready to be merged. It passes all tests.
On Sunday, 4 August 2013 23:15:39 UTC+1, Aaron Meurer wrote: > > Returning a string is much better. If you want to do anything with the > string (including print it), you can do it if you return the string. > But if you print the string, you can't do anything with it. > > I wouldn't include a newline at the end. The other SymPy printers do > not do this. It will just result in an empty space at the end of the > output that will look strange. > > You might look at how the other SymPy printers work. For example, > pprint() prints an expression and pretty() gives the string form. > pprint() is only for convenience, so you don't have to type "print" to > get nice output. See > http://docs.sympy.org/0.7.3/tutorial/printing.html for more > information. > > Aaron Meurer > > > On Sun, Aug 4, 2013 at 11:58 AM, David Joyner > <wdjo...@gmail.com<javascript:>> > wrote: > > On Sun, Aug 4, 2013 at 10:06 AM, Mary Clark > > <mary.sp...@gmail.com<javascript:>> > wrote: > >> David: The dynkin_diagram method does return a string. However, it has > a > >> newline character in it, so you need a print statement to make things > show > >> up in two lines, rather than one line with a "\n". > >> > > > > Okay. In that case, what I often do is add an optional parameter, say > > verbose=False, > > which will only execute the print statement if verbose=True. That way, > > you return > > a string, which is easy to test for in docstrings, and the user can see > the > > multi-line version if they want, but it doesn't have to be tested. > > Just an idea to think about if you want. > > > > > > > >> > >> On Friday, 2 August 2013 22:33:04 UTC+1, David Joyner wrote: > >>> > >>> > >>> > >>> On Friday, August 2, 2013, Mary Clark wrote: > >>>> > >>>> Additionally, regarding PR 2344, in my docstring for > dynkin_diagram.py I > >>>> have a print statement: > >>>> > >>>> >>> print DynkinDiagram("A3") > >>>> 0---0---0 > >>>> 1 2 3 > >>>> > >>>> Now, I just found out how in python 3.x print is now a function, so > you > >>>> need print(DynkinDiagram("A3")) which is why the doctests are failing > for > >>>> python 3.2 and 3.3. I'm not sure how to fix this, as it seems to me, > no > >>>> matter what, the doctests will either fail for 2.6 and 2.7 or 3.2 and > 3.3. > >>>> > >>>> Thoughts? > >>> > >>> > >>> My preference is to *never* have methods that don't return something. > When > >>> I want a function to print, I return a string. > >>> I think it is more pythonic to avoid methods that simply print > something. > >>> > >>> Besides, if you return a string then you won't run into these doctest > >>> issues:-) > >>> > >>> > >>>> > >>>> -- > >>>> You received this message because you are subscribed to the Google > Groups > >>>> "sympy" group. > >>>> To unsubscribe from this group and stop receiving emails from it, > send an > >>>> email to sympy+un...@googlegroups.com <javascript:>. > >>>> To post to this group, send email to > >>>> sy...@googlegroups.com<javascript:>. > > >>>> Visit this group at http://groups.google.com/group/sympy. > >>>> For more options, visit https://groups.google.com/groups/opt_out. > >>>> > >>>> > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "sympy" group. > >> To unsubscribe from this group and stop receiving emails from it, send > an > >> email to sympy+un...@googlegroups.com <javascript:>. > >> To post to this group, send email to sy...@googlegroups.com<javascript:>. > > >> Visit this group at http://groups.google.com/group/sympy. > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > >> > > > > -- > > You received this message because you are subscribed to the Google > Groups "sympy" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to sympy+un...@googlegroups.com <javascript:>. > > To post to this group, send email to sy...@googlegroups.com<javascript:>. > > > Visit this group at http://groups.google.com/group/sympy. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.