> > Cool. So the next step is to make this work: >> >> x = Symbol('x') >> assert ask(x, Q.integer) is None >> local_context = AssumptionsContext() >> local_context.add(Assume(x, Q.integer)) >> with local_context: >> assert ask(x, Q.integer) is True >> > > It doesn't really need any setup / tear-down...you mean to switch what > the global_assumptions points to during the 'with' block? > > > I am having trouble understanding what you are saying here. Whatever you > mean, what I'm saying is like the idea suggested at the top of issue 1047. >
Ahh, I see what you mean. I was referring to what needs to be implemented in the foo object in order for 'with foo' to actually work. I could re-write Assume to inherit from AssumptionsContext, and then have AssumptionsContext augment the global_assumptions when used in a with statement...should be doable. I'll write this up as another issue, since there may be unforseen roadblocks between my SoC work and achieving it ;). Thanks for the pointer. Cheers -- You received this message because you are subscribed to the Google Groups "sympy-patches" group. To post to this group, send email to sympy-patc...@googlegroups.com. To unsubscribe from this group, send email to sympy-patches+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy-patches?hl=en.