If you think that adding something like this will make it easier for people to 
add their own custom pretty printers to their custom classes, feel free to send 
in a patch that fixes it.  Don't be afraid of breaking things in the SymPy 
code, because you can always run "./bin/test" and "./bin/doctest" to see if you 
have broken anything or not.

By the way, I am assuming from the name and from the fact that you want to do 
this that MyClassExpr is inheriting from Expr.  How would this work if your 
class is a part of some other SymPy class, like an Add or a Mul?  I'm not too 
familiar with how it works, but I know that pretty() internally has some bounds 
stuff to make the 2-dimensional printing work correctly with each other (like 
if you have an expression that is 3 lines tall surrounded by parentheses, then 
you need parentheses that are 3 lines tall).  Would your idea work seamlessly 
with this?  

Aaron Meurer

On Dec 13, 2010, at 12:33 PM, Alexey U. Gudchenko wrote:

> 
> 
> Hello,
> Sorry for my english.
> 
> In "sympy.printing.mathml.py" there is a property printmethod of the
> class MathMLPrinter defined:
> 
>       printmethod = "_mathml_"
> 
> Why don't to add the line (like it) in PrettyPrinter class
> (sympy.printing.pretty.pretty.py)?
> 
> Saying:
> 
>       printmethod = "_pretty_"
> 
> 
> This can be useful when I want to describe MyClassExpr with _pretty_
> method in it.
> 
> Now I did not found the other method to do it, except to add the
> PrettyPrinter._print_MyClassExpr method in the core(pretty.py) file.
> 
> (And I don't want to do edit core file)
> 
> 
> Thank you.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/sympy?hl=en.
> 

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

Reply via email to