[SciPy-dev] Merged numarray branch
Robert Kern
rkern at ucsd.edu
Tue Jan 11 07:54:12 CST 2005
Norbert Nemec wrote:
> How about adding one more way to configure numerix: apart from checking the
> command line and the environment, one could also check a global variable
> 'numerix':
>
> if 'numerix' in globals().keys():
> which = globals()['numerix'], 'global variable'
>
> That way, one could simply do a
>
> globals()['numerix'] = 'numarray'
> from scipy import *
>
> at the beginning of a script without worrying about the environment.
globals() is actually local to the module.
#--file1.py--
globals()['numerix'] = 'numarray
import file2
#------------
#--file2.py--
print globals()['numerix']
#------------
$ python file2.py
Traceback (most recent call last):
File "file1.py", line 2, in ?
import file2
File "/Users/kern/file2.py", line 1, in ?
print globals()['numerix']
KeyError: 'numerix'
I think it's better to have an external setting which will work with all
packages that have numerix capabilities (like matplotlib and scipy).
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Scipy-dev
mailing list