Yeah you mentioned that about the subclasses, which is why my first
instinct was to come here rather than stackoverflow when I encountered this
problem. Also about the string printer, I'm exclusively using the latex
printer so this is not a problem :-). Thanks


On 20 September 2013 09:19, Aaron Meurer <[email protected]> wrote:

> Great to hear that. I wish we could get rid of the class registry so
> this issue wouldn't happen.
>
> Another thing I though of. Depending on what you're doing, you might
> also want to override the string printer, so that your class prints as
> exp(x) instead of noevalexp(x) (unless you want it to print as
> noevalexp(x)).
>
> And as I think I mentioned earlier, there are several places in SymPy
> that are not written correctly to be nice to subclasses (see
> https://code.google.com/p/sympy/issues/detail?id=3652), so if you come
> across something else that doesn't work, there's a good chance that it
> too is a SymPy issue, not your issue.
>
> Aaron Meurer
>
>
> On Thu, Sep 19, 2013 at 5:12 PM, Ben Lucato <[email protected]> wrote:
> > Hey Aaron, you were spot on with your guess. Renaming the subclass to
> > noevalexp solves the issue. You rock!!!!!
> >
> >
> > On 20 September 2013 04:02, Aaron Meurer <[email protected]> wrote:
> >>
> >> I can only guess at what's happening, but does it work if you don't
> >> name the class "exp"? There is (unfortunately) a global class registry
> >> in SymPy that uses the name of the class, so a subclass called "exp"
> >> might inadvertently override exp for other parts of SymPy.
> >>
> >> If this is the issue, you can always call the class something like
> >> UnevaluatedExp, and then put "exp = UnevaluatedExp" at the end of the
> >> definition for convenience (or always import it as "from module import
> >> UnevaluatedExp as exp"). The important thing is the __name__ of the
> >> class.
> >>
> >> Of course, we really should get rid of the class registry. But it
> >> hasn't been done yet.
> >>
> >> Aaron Meurer
> >>
> >> On Wed, Sep 18, 2013 at 11:51 PM, Ben Lucato <[email protected]>
> wrote:
> >> > I know this is looking back a month or two, but I have just started to
> >> > use
> >> > your idea about subclassing.
> >> >
> >> > However, it is having unintended side effects.
> >> >
> >> > Including the code:
> >> >
> >> > class exp(sympy.exp):
> >> >     @classmethod
> >> >     def eval(cls, arg):
> >> >         return
> >> >
> >> > in a module like noevals.py, and then subsequently importing noevals
> has
> >> > disabled eval in the regular sympy.exp. I am super new to subclassing
> in
> >> > general, but I know it's this code because when I delete these 4 lines
> >> > the
> >> > problem goes away. How do I retain this subclass without altering the
> >> > parent's behaviour?
> >> >
> >> > --
> >> > 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 [email protected].
> >> > To post to this group, send email to [email protected].
> >> > 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 a topic in the
> >> Google Groups "sympy" group.
> >> To unsubscribe from this topic, visit
> >> https://groups.google.com/d/topic/sympy/zilEXwN26so/unsubscribe.
> >> To unsubscribe from this group and all its topics, send an email to
> >> [email protected].
> >>
> >> To post to this group, send email to [email protected].
> >> Visit this group at http://groups.google.com/group/sympy.
> >> For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
> >
> >
> > --
> >
> >
> > Ben Lucato
> >
> ----------------------------------------------------------------------------------
> > Phone: +61 400 159 632 | Email: [email protected]
> >
> > --
> > 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 [email protected].
> > To post to this group, send email to [email protected].
> > 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 a topic in the
> Google Groups "sympy" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sympy/zilEXwN26so/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 


Ben Lucato
----------------------------------------------------------------------------------
Phone: +61 400 159 632 | Email: [email protected]

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to