On Mon, Oct 27, 2008 at 2:40 AM, Alan Bromborsky <[EMAIL PROTECTED]> wrote: > > I am creating a new printer class 'LaTeXPrinter' which is an extension > of the 'LatexPrinter' class. In the class I am trying to code the > function '_print_MV'. However my 'LaTeXPrinter' class does not use > '_print_MV' when I try to print an instantiation of MV. If x is an > instantiation of MV then type(x) returns <type 'instance'> instead of > <type 'MV'>. What is the correct way of instantiating MV so that > type(x) returns the class type? > > > >
Don't declare an __init__ method in your class. The way most objects are handled is by using the __new__ method, which checks types, sympify's the args, and puts the object into a canonical form, then hand it off to Basic.__new__ to do it's magic. -- Andy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
