Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 31 #292

Merged
merged 1 commit into from Mar 25, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 5 additions & 6 deletions IPython/core/magic.py
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand Down