Status: Started Owner: Vinzent.Steinberg Labels: Type-Defect Priority-Medium Assumptions
New issue 1884 by Vinzent.Steinberg: local assumptions http://code.google.com/p/sympy/issues/detail?id=1884 On sympy-patches I said: "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." Well, local assumptions are much harder to implement that I thought. Actually I need the 'nonlocal' statement from Python 3. :) The problem is that I need to define a variable in the outer scope, which is apparently not possible in Python 2. 'exec' allows to define a locals and globals dict that gets respected, but it does not seem to affect the "real" globals and locals correctly My not-working-as-wanted code can be pulled from g...@github.com:vks/sympy.git local_assump -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings -- You received this message because you are subscribed to the Google Groups "sympy-issues" group. To post to this group, send email to sympy-iss...@googlegroups.com. To unsubscribe from this group, send email to sympy-issues+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy-issues?hl=en.