float64 print digits
I need a pytho nscript to read numbers(with loads of digits) from a file, do some basic math on it and write the result out to another file. My problem: I don't get python to use more digits: In order to try this I type: The normal precision one: >>> from numpy import * >>> x=1.23456789123456789123456789 >>> print "%35.25e" %x 1.23456789123456790e+000 Now I try to use float64 to get more digits >>> z=zeros(3,float64) >>> z[0] 0.0 >>> type(z[0]) >>> z[0]=1.23456789123456789123456789 >>> type(z[0]) >>> print "%35.25e" %z[0] 1.23456789123456790e+000 This cuts the digits just like the 32bit case. Can anyone please help me get more digits? Thank you very much in advance, Ulrich -- http://mail.python.org/mailman/listinfo/python-list
access interactive namespace from module (shared namespace?)
I've got a probably embarrassing trivial problem with namespaces, but couldn't solve it myself nor find an answer in the net. Hopefully one of you guys can help me. What I want to do: Use the interactive shell and e.g define the variable a there. Then load a module and access a from within. e.g file "utest.py" def doit(): print 2*a in the shell: import utest a=3 utest.doit() <- I want this to print 2*a, but of course obtain: exceptions.NameError'>: global name 'a' is not defined Any change I do to a in the shell should be seen from the doit() function, any variable assignment I do in the doit() function should be seen in the shell. I guess it's somehow a namespace sharing. Actually the function doit() will contain an eval() function that should evaluate a (via a gui) dynamically inserted expression. Any one got a clue? (a clue what I try to say and how to help?!) Thanks a lot in advance!! Ulrich -- http://mail.python.org/mailman/listinfo/python-list