##// END OF EJS Templates
%whos abbreviates typename of Macro
vivainio -
Show More
@@ -1,7 +1,7 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Magic functions for InteractiveShell.
3 3
4 $Id: Magic.py 1934 2006-11-26 20:37:01Z vivainio $"""
4 $Id: Magic.py 1941 2006-11-26 22:24:43Z vivainio $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
@@ -961,15 +961,24 b' Currently the magic system has the following functions:\\n"""'
961 961 array_type = Numeric.ArrayType.__name__
962 962
963 963 # Find all variable names and types so we can figure out column sizes
964 get_vars = lambda i: self.shell.user_ns[i]
965 type_name = lambda v: type(v).__name__
964
965 def get_vars(i):
966 return self.shell.user_ns[i]
967
968 # some types are well known and can be shorter
969 abbrevs = {'IPython.macro.Macro' : 'Macro'}
970 def type_name(v):
971 tn = type(v).__name__
972 return abbrevs.get(tn,tn)
973
966 974 varlist = map(get_vars,varnames)
967 975
968 976 typelist = []
969 977 for vv in varlist:
970 978 tt = type_name(vv)
979
971 980 if tt=='instance':
972 typelist.append(str(vv.__class__))
981 typelist.append( abbrevs.get(str(vv.__class__),str(vv.__class__)))
973 982 else:
974 983 typelist.append(tt)
975 984
@@ -17,6 +17,8 b''
17 17
18 18 * macro.py: Give Macro a useful __repr__ method
19 19
20 * Magic.py: %whos abbreviates the typename of Macro for brevity.
21
20 22 2006-11-24 Walter Doerwald <walter@livinglogic.de>
21 23 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
22 24 we don't get a duplicate ipipe module, where registration of the xrepr
General Comments 0
You need to be logged in to leave comments. Login now