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 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