Le jeudi 05 mai 2011 à 20:35 +0100, Tom Bachmann a écrit : > On 05.05.2011 17:35, Ronan Lamy wrote: > > Le jeudi 05 mai 2011 à 10:27 -0400, Haz a écrit : > >> Well as far as I understand the problems wrt caching and > >> assumptions in the current model are: > >> > >> 1) Assumptions are tied in at the lowest level of the core > >> (which apparently is a problem; I am just accepting that as a > >> fact of life for now). > >> 2) If we remove assumptions from objects entirely the cache > >> breaks down. (Apart from there not being a viable transition > >> strategy, as far as I see.) > >> 3) There are certain hacks to fix this like flushing the cache > >> aggressively, but they remain hacks. > >> 4) At any rate the cache causes lots of headaches and there > >> are calls for disabling it in general. > >> 5) But that won't work either because our performance depends > >> crucially on it for some computations. > >> > >> Having assumptions at a mix-in lower down in the algebra > >> hierarchy solves (1) [I think], avoids the trouble with (2) > >> and (3). Similarly having caching as a "mixin algebra" solves > >> (4) without the hacks of (5). > > > > If you mean something like > > https://github.com/rlamy/sympy/tree/refactor-assumptions , it can be > > done, but doesn't buy us much. > > > > Can you describe what you have done there? I had a look at the code but > chances are I'm missing important points. > > Why does this not buy us much? If I understand correctly you moved the > assumptions logic to a mixin. This sounds like a first step to me to > having swappable assumptions implementations, and indeed no-op > assumptions if this is desirable.
Well, I meant that it's only a first step. I was trying to solve a different problem: the new assumptions require logic, but the (new) logic classes derive from Basic, so in order to replace the old assumptions with the new ones, nothing in Basic or sympy.logic should depend on the old assumptions (that, BTW, was also the fundamental reason for the Basic/Expr split). So, the only changes directly relevant to what we're discussing are indeed that I moved all the assumption code to sympy/core/assumptions.py, but it's more than just a mixin, there's also a metaclass and a few module-global parameters. I hadn't thought of swappable implementations, actually. I guess my branch would be easier to follow if I reorganised it with that in mind. I could also crank up the magic a bit so that a single __metaclass__ definition or class decorator (in 2.6+) would be enough to define assumptions. -- 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.
