##// END OF EJS Templates
Fixes and updates to %whos command.
Thomas Kluyver -
Show More
@@ -25,7 +25,6 b' import shutil'
25 25 import re
26 26 import time
27 27 import textwrap
28 import types
29 28 from cStringIO import StringIO
30 29 from getopt import getopt,GetoptError
31 30 from pprint import pformat
@@ -57,7 +56,7 b' import IPython.utils.io'
57 56 from IPython.utils.path import get_py_filename
58 57 from IPython.utils.process import arg_split, abbrev_cwd
59 58 from IPython.utils.terminal import set_term_title
60 from IPython.utils.text import LSString, SList, StringTypes, format_screen
59 from IPython.utils.text import LSString, SList, format_screen
61 60 from IPython.utils.timing import clock, clock2
62 61 from IPython.utils.warn import warn, error
63 62 from IPython.utils.ipstruct import Struct
@@ -848,7 +847,7 b' Currently the magic system has the following functions:\\n"""'
848 847
849 848 - For {},[],(): their length.
850 849
851 - For numpy and Numeric arrays, a summary with shape, number of
850 - For numpy arrays, a summary with shape, number of
852 851 elements, typecode and size in memory.
853 852
854 853 - Everything else: a string representation, snipping their middle if
@@ -881,7 +880,7 b' Currently the magic system has the following functions:\\n"""'
881 880 # if we have variables, move on...
882 881
883 882 # for these types, show len() instead of data:
884 seq_types = [types.DictType,types.ListType,types.TupleType]
883 seq_types = ['dict', 'list', 'tuple']
885 884
886 885 # for numpy/Numeric arrays, display summary info
887 886 try:
@@ -940,7 +939,7 b' Currently the magic system has the following functions:\\n"""'
940 939 for vname,var,vtype in zip(varnames,varlist,typelist):
941 940 print itpl(vformat),
942 941 if vtype in seq_types:
943 print len(var)
942 print "n="+str(len(var))
944 943 elif vtype in [array_type,ndarray_type]:
945 944 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
946 945 if vtype==ndarray_type:
@@ -2307,7 +2306,7 b' Currently the magic system has the following functions:\\n"""'
2307 2306
2308 2307 #print '*** args',args,'type',type(args) # dbg
2309 2308 data = eval(args,self.shell.user_ns)
2310 if not type(data) in StringTypes:
2309 if not isinstance(data, basestring):
2311 2310 raise DataIsObject
2312 2311
2313 2312 except (NameError,SyntaxError):
General Comments 0
You need to be logged in to leave comments. Login now