##// END OF EJS Templates
Make hard reset the default with %reset.
Thomas Kluyver -
Show More
@@ -971,10 +971,10 b' Currently the magic system has the following functions:\\n"""'
971 971 ----------
972 972 -f : force reset without asking for confirmation.
973 973
974 -h : 'Hard' reset: gives you a new session and removes all
975 references to objects from the current session. By default, we
976 do a 'soft' reset, which only clears out your namespace, and
977 leaves input and output history around.
974 -s : 'Soft' reset: Only clears your namespace, leaving history intact.
975 References to objects may be kept. By default (without this option),
976 we do a 'hard' reset, giving you a new session and removing all
977 references to objects from the current session.
978 978
979 979 Examples
980 980 --------
@@ -988,8 +988,8 b' Currently the magic system has the following functions:\\n"""'
988 988
989 989 In [9]: %reset -f
990 990
991 In [10]: 'a' in _ip.user_ns
992 Out[10]: False
991 In [1]: 'a' in _ip.user_ns
992 Out[1]: False
993 993 """
994 994 opts, args = self.parse_options(parameter_s,'fh')
995 995 if 'f' in opts:
@@ -1000,14 +1000,16 b' Currently the magic system has the following functions:\\n"""'
1000 1000 if not ans:
1001 1001 print 'Nothing done.'
1002 1002 return
1003
1004 if 'h' in opts: # Hard reset
1005 self.shell.reset(new_session = True)
1006
1007 else: # Soft reset
1003
1004 if 's' in opts: # Soft reset
1008 1005 user_ns = self.shell.user_ns
1009 1006 for i in self.magic_who_ls():
1010 1007 del(user_ns[i])
1008
1009 else: # Hard reset
1010 self.shell.reset(new_session = True)
1011
1012
1011 1013
1012 1014 def magic_reset_selective(self, parameter_s=''):
1013 1015 """Resets the namespace by removing names defined by the user.
@@ -392,7 +392,7 b' def test_reset_hard():'
392 392 _ip.run_cell("a")
393 393
394 394 nt.assert_equal(monitor, [])
395 _ip.magic_reset("-hf")
395 _ip.magic_reset("-f")
396 396 nt.assert_equal(monitor, [1])
397 397
398 398 def doctest_who():
General Comments 0
You need to be logged in to leave comments. Login now