##// END OF EJS Templates
Merge pull request #910 from minrk/pypynumpy...
Min RK -
r5198:4c90e861 merge
parent child Browse files
Show More
@@ -861,19 +861,15 b' Currently the magic system has the following functions:\\n"""'
861 # for these types, show len() instead of data:
861 # for these types, show len() instead of data:
862 seq_types = ['dict', 'list', 'tuple']
862 seq_types = ['dict', 'list', 'tuple']
863
863
864 # for numpy/Numeric arrays, display summary info
864 # for numpy arrays, display summary info
865 try:
865 ndarray_type = None
866 import numpy
866 if 'numpy' in sys.modules:
867 except ImportError:
867 try:
868 ndarray_type = None
868 from numpy import ndarray
869 else:
869 except ImportError:
870 ndarray_type = numpy.ndarray.__name__
870 pass
871 try:
871 else:
872 import Numeric
872 ndarray_type = ndarray.__name__
873 except ImportError:
874 array_type = None
875 else:
876 array_type = Numeric.ArrayType.__name__
877
873
878 # Find all variable names and types so we can figure out column sizes
874 # Find all variable names and types so we can figure out column sizes
879 def get_vars(i):
875 def get_vars(i):
@@ -918,7 +914,7 b' Currently the magic system has the following functions:\\n"""'
918 print vformat.format(vname, vtype, varwidth=varwidth, typewidth=typewidth),
914 print vformat.format(vname, vtype, varwidth=varwidth, typewidth=typewidth),
919 if vtype in seq_types:
915 if vtype in seq_types:
920 print "n="+str(len(var))
916 print "n="+str(len(var))
921 elif vtype in [array_type,ndarray_type]:
917 elif vtype == ndarray_type:
922 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
918 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
923 if vtype==ndarray_type:
919 if vtype==ndarray_type:
924 # numpy
920 # numpy
General Comments 0
You need to be logged in to leave comments. Login now