##// END OF EJS Templates
Simpler/cleaner version of %who_ls....
Fernando Perez -
Show More
@@ -875,7 +875,7 b' Currently the magic system has the following functions:\\n"""'
875 show_all=opt('a'),ignore_case=ignore_case)
875 show_all=opt('a'),ignore_case=ignore_case)
876 except:
876 except:
877 shell.showtraceback()
877 shell.showtraceback()
878
878
879 def magic_who_ls(self, parameter_s=''):
879 def magic_who_ls(self, parameter_s=''):
880 """Return a sorted list of all interactive variables.
880 """Return a sorted list of all interactive variables.
881
881
@@ -885,17 +885,15 b' Currently the magic system has the following functions:\\n"""'
885 user_ns = self.shell.user_ns
885 user_ns = self.shell.user_ns
886 internal_ns = self.shell.internal_ns
886 internal_ns = self.shell.internal_ns
887 user_config_ns = self.shell.user_config_ns
887 user_config_ns = self.shell.user_config_ns
888 out = []
888 out = [ i for i in user_ns
889 if not i.startswith('_') \
890 and not (i in internal_ns or i in user_config_ns) ]
891
889 typelist = parameter_s.split()
892 typelist = parameter_s.split()
893 if typelist:
894 typeset = set(typelist)
895 out = [i for i in out if type(i).__name__ in typeset]
890
896
891 for i in user_ns:
892 if not (i.startswith('_') or i.startswith('_i')) \
893 and not (i in internal_ns or i in user_config_ns):
894 if typelist:
895 if type(user_ns[i]).__name__ in typelist:
896 out.append(i)
897 else:
898 out.append(i)
899 out.sort()
897 out.sort()
900 return out
898 return out
901
899
General Comments 0
You need to be logged in to leave comments. Login now