On Fri, Feb 24, 2012 at 3:10 AM, Bharath M R <catchmr...@gmail.com> wrote:
> I created a branch on my desktop and tried to run the tests. All the tests
> in test_GA.py are not working. Should I report it as an issue?
Yes, please do. Send the whole test output.
All tests should run.
Thanks,
Ondrej
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
Aaron Meurer
from inspect import currentframe
frame = currentframe().f_back
def test_frame():
frame.f_globals['x'] = (1,2)
return
test_frame()
print x
"""
Traceback (most recent call last):
File "frame.py", line 8, in <module>
test_frame()
File "frame.py", line 5, in test_frame
frame.f_globals['x'] = (1,2)
AttributeError: 'NoneType' object has no attribute 'f_globals'
"""
I am using python 2.7 and it appears currentframe().f_back is not a
dictionary.
Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sympy/-/-6EhDxmVB3sJ.
(e1,e2,e3)=MV.setup('e_1 e_2 e_3')
This has the advantage in that the name of the variable does not have to
be the variable symbol so that one can use a
short name in the program and a long desrciptive name in the output. In
my rewrite I print basis bases and blades in boldface. The only objects
that were injected into the global name space were the basis vectors and
there are only usually 3 to 6 of them max so that it is not worth the
effort to inject them!
Note that even var() doesn't always "work" as regular name assignment.
For example, suppose I have the following:
from sympy import var
def test():
var('x')
print x
def test2():
var('y')
print y
z = 1
test2()
print y
print z
test()
Now, if this worked like it should, the "print y" in test() but not in
test2() should raise a NameError, because it was only defined in the
scope of test2(). But if you run this, you get
x
y
y
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 10, in test
NameError: global name 'z' is not defined
The two "y"s in the output show that the name is defined in both
places. The final NameError shows that this doesn't happen for
normally defined variables.
That's just one thing that can happen with this sort of thing. There
are other things too. Depending on what you do with the frame, it may
not be supported in alternate Python implementations like Jython,
PyPy, or IronPython. And see
http://code.google.com/p/sympy/issues/detail?id=1198 for an example of
where this sort of things would actually be useful, but it doesn't
work in all cases, so isn't.
Aaron Meurer