Issue 31 #292

Merged
merged 1 commit into from Mar 25, 2011
View
@@ -25,7 +25,6 @@
import re
import time
import textwrap
-import types
from cStringIO import StringIO
from getopt import getopt,GetoptError
from pprint import pformat
@@ -57,7 +56,7 @@
from IPython.utils.path import get_py_filename
from IPython.utils.process import arg_split, abbrev_cwd
from IPython.utils.terminal import set_term_title
-from IPython.utils.text import LSString, SList, StringTypes, format_screen
+from IPython.utils.text import LSString, SList, format_screen
from IPython.utils.timing import clock, clock2
from IPython.utils.warn import warn, error
from IPython.utils.ipstruct import Struct
@@ -848,7 +847,7 @@ def magic_whos(self, parameter_s=''):
- For {},[],(): their length.
- - For numpy and Numeric arrays, a summary with shape, number of
+ - For numpy arrays, a summary with shape, number of
elements, typecode and size in memory.
- Everything else: a string representation, snipping their middle if
@@ -881,7 +880,7 @@ def magic_whos(self, parameter_s=''):
# if we have variables, move on...
# for these types, show len() instead of data:
- seq_types = [types.DictType,types.ListType,types.TupleType]
+ seq_types = ['dict', 'list', 'tuple']
# for numpy/Numeric arrays, display summary info
try:
@@ -940,7 +939,7 @@ def type_name(v):
for vname,var,vtype in zip(varnames,varlist,typelist):
print itpl(vformat),
if vtype in seq_types:
- print len(var)
+ print "n="+str(len(var))
elif vtype in [array_type,ndarray_type]:
vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
if vtype==ndarray_type:
@@ -2307,7 +2306,7 @@ class DataIsObject(Exception): pass
#print '*** args',args,'type',type(args) # dbg
data = eval(args,self.shell.user_ns)
- if not type(data) in StringTypes:
+ if not isinstance(data, basestring):
raise DataIsObject
except (NameError,SyntaxError):