[sympy] Re: Help with aliasing assumptions

2014-09-19 Thread Chris Smith
The assumptions system will try to call `_eval_is_foo` if it exists for the object. So if you add definitions for ``_eval_is_integer` to your Routine object you can return the value of `is_integer` for the return value. I suspect there will be issues with how you define Routine, however, since i

Re: [sympy] Re: Help with aliasing assumptions

2014-09-19 Thread James Crist
> > it looks like in the first example that the expression is returned > directly while in the second case it is not(?) Ideally, for routines with one expr, `routine` and `routine[0]` will be identical. Not sure if this is possible, and I may decide that's too much magic. The main purpose behind

Re: [sympy] Re: Help with aliasing assumptions

2014-09-19 Thread Aaron Meurer
On Fri, Sep 19, 2014 at 9:20 AM, James Crist wrote: >> it looks like in the first example that the expression is returned >> directly while in the second case it is not(?) > > > Ideally, for routines with one expr, `routine` and `routine[0]` will be > identical. Not sure if this is possible, and I

Re: [sympy] Re: Help with aliasing assumptions

2014-09-19 Thread Aaron Meurer
On Fri, Sep 19, 2014 at 1:52 PM, Aaron Meurer wrote: > On Fri, Sep 19, 2014 at 9:20 AM, James Crist wrote: >>> it looks like in the first example that the expression is returned >>> directly while in the second case it is not(?) >> >> >> Ideally, for routines with one expr, `routine` and `routine

Re: [sympy] Re: Help with aliasing assumptions

2014-09-25 Thread James Crist
So I've spent some time trying to get this to work, and am still struggling. Here's what I've tried: 1.) Subclass from `Expr`. Define `__getattr__`, and alias calls over to the base expr. Unfortunately, `__getattr__` is only called for attributes that are missing, and since all the `is_*` attri

Re: [sympy] Re: Help with aliasing assumptions

2014-09-26 Thread James Crist
Finally figured this all out (at least for everything I've tried it works). Option #3 described above was almost correct. Instead of setting the `_assumptions` attributes equal between the alias and the expression though, the `_assumptions` attribute should be cleared for the alias. If it has a