I think this is more or less what I meant. When I said, "global assumptions," I meant assumptions that you can stick with a symbol throughout a scope, as opposed to having to manually tack on an Assume object whenever you want to use those assumptions. But of course they will need to be localized throughout a scope.
Aaron Meurer On Apr 1, 2010, at 2:20 PM, Vinzent Steinberg wrote: > 2010/4/1 Aaron S. Meurer <asmeu...@gmail.com>: >> I like this idea. Maybe it doesn't necessarily have to be tied to Symbol. >> If there is some kind of global assumptions table, or you are in some "with >> Assume(x, Q.something):" context, then x.is_something would just be a >> shortcut to look it up in there. It may make it seem to the user that the >> assumptions are stored in the symbol, but it doesn't really matter because >> that is just an implementation detail that he won't even care about either >> way, unless he wants to implement some assumptions or a special symbol type >> of his own. >> > > Global assumptions are a mess, you actually never want them, I think > they should be removed from sympy. It works only for very simple and > small scripts, but not for complex stuff. If some part of your code > uses > > x = Symbol('x', positive=True) > > and another part > > x = Symbol('x', negative=True) > > you got a problem. Even if you overwrite the global assumption, it > does not work if you call a subroutine that changes them and breaks > the assumptions of the routine calling the subroutine. > > Really, you don't want global assumptions, you want local assumptions. > > Using Python's introspection, it should be easy to implement > assumptions that are only valid for the local scope and automatically > garbage-collected if no longer necessary. It would be maybe somewhat > hackish, but it is clearly defined behavior. > > It would be a solution to clean your global assumptions explicitly, > but this is not backward-backward compatible and unnecessarily > cumbersome. And it's a huge amount of useless code added to sympy. > > Vinzent > > -- > 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. > -- 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.