Yes I agree that single underscores are better. This patch fixes that.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-patches" group.
To post to this group, send email to sympy-patches@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sympy-patches?hl=en
-~----------~----~----~----~------~----~------~--~---

# HG changeset patch
# User Sebastian Krämer <[EMAIL PROTECTED]>
# Date 1225899901 28800
# Node ID 4f01998b11897f4ba4a71d9c91948ee3122118ca
# Parent  aaaf53f1c529be7498746e419e1447be3d634931
Rename printmethods from double to single underscore.

diff -r aaaf53f1c529 -r 4f01998b1189 sympy/printing/latex.py
--- a/sympy/printing/latex.py   Tue Nov 04 18:04:02 2008 -0800
+++ b/sympy/printing/latex.py   Wed Nov 05 07:45:01 2008 -0800
@@ -1,12 +1,14 @@ from sympy.core import S, C, Basic, Symb
+"""
+A Printer which converts an expression into its LaTeX equivalent.
+"""
+
 from sympy.core import S, C, Basic, Symbol
 from printer import Printer
 from sympy.simplify import fraction
 import re
 
 class LatexPrinter(Printer):
-    """A printer which converts an expression into its LaTeX equivalent."""
-
-    printmethod = "__latex__"
+    printmethod = "_latex_"
 
     def __init__(self, inline=True):
         Printer.__init__(self)
diff -r aaaf53f1c529 -r 4f01998b1189 sympy/printing/mathml.py
--- a/sympy/printing/mathml.py  Tue Nov 04 18:04:02 2008 -0800
+++ b/sympy/printing/mathml.py  Wed Nov 05 07:45:01 2008 -0800
@@ -1,10 +1,12 @@ from sympy import Basic, sympify
+"""
+A MathML printer.
+"""
+
 from sympy import Basic, sympify
 from printer import Printer
 
-
 class MathMLPrinter(Printer):
-    """A MathML printer."""
-    printmethod = "__mathml__"
+    printmethod = "_mathml_"
 
     def __init__(self, *args, **kwargs):
         Printer.__init__(self, *args, **kwargs)
diff -r aaaf53f1c529 -r 4f01998b1189 sympy/printing/repr.py
--- a/sympy/printing/repr.py    Tue Nov 04 18:04:02 2008 -0800
+++ b/sympy/printing/repr.py    Wed Nov 05 07:45:01 2008 -0800
@@ -12,7 +12,8 @@ from sympy.mpmath.settings import prec_t
 from sympy.mpmath.settings import prec_to_dps, repr_dps
 
 class ReprPrinter(Printer):
-    printmethod = "__sympyrepr__"
+    printmethod = "_sympyrepr_"
+
     def reprify(self, args, sep):
         return sep.join([self.doprint(item) for item in args])
 
diff -r aaaf53f1c529 -r 4f01998b1189 sympy/printing/str.py
--- a/sympy/printing/str.py     Tue Nov 04 18:04:02 2008 -0800
+++ b/sympy/printing/str.py     Wed Nov 05 07:45:01 2008 -0800
@@ -14,7 +14,7 @@ from sympy.mpmath.settings import prec_t
 from sympy.mpmath.settings import prec_to_dps
 
 class StrPrinter(Printer):
-    printmethod = "__sympystr__"
+    printmethod = "_sympystr_"
 
     def parenthesize(self, item, level):
         if precedence(item) <= level:
diff -r aaaf53f1c529 -r 4f01998b1189 sympy/printing/tests/test_latex.py
--- a/sympy/printing/tests/test_latex.py        Tue Nov 04 18:04:02 2008 -0800
+++ b/sympy/printing/tests/test_latex.py        Wed Nov 05 07:45:01 2008 -0800
@@ -11,7 +11,7 @@ k,n = symbols('kn', integer=True)
 
 def test_printmethod():
     class R(abs):
-        def __latex__(self):
+        def _latex_(self):
             return "foo"
     assert latex(R(x)) == "$foo$"
 
diff -r aaaf53f1c529 -r 4f01998b1189 sympy/printing/tests/test_repr.py
--- a/sympy/printing/tests/test_repr.py Tue Nov 04 18:04:02 2008 -0800
+++ b/sympy/printing/tests/test_repr.py Wed Nov 05 07:45:01 2008 -0800
@@ -31,7 +31,7 @@ def sT(expr, string):
 
 def test_printmethod():
     class R(oo.__class__):
-        def __sympyrepr__(self):
+        def _sympyrepr_(self):
             return "foo"
     assert srepr(R()) == "foo"
 
diff -r aaaf53f1c529 -r 4f01998b1189 sympy/printing/tests/test_str.py
--- a/sympy/printing/tests/test_str.py  Tue Nov 04 18:04:02 2008 -0800
+++ b/sympy/printing/tests/test_str.py  Wed Nov 05 07:45:01 2008 -0800
@@ -23,7 +23,7 @@ d = Symbol('d', dummy=True)
 
 def test_printmethod():
     class R(abs):
-        def __sympystr__(self):
+        def _sympystr_(self):
             return "foo"
     assert spr(R(x)) == "foo"
 

Reply via email to