diff --git a/IPython/core/history.py b/IPython/core/history.py index 7734780..9a4a249 100644 --- a/IPython/core/history.py +++ b/IPython/core/history.py @@ -762,8 +762,10 @@ def magic_history(self, parameter_s = ''): the default is the last 10 lines. -f FILENAME: instead of printing the output to the screen, redirect it to - the given file. The file is always overwritten, though IPython asks for - confirmation first if it already exists. + the given file. The file is always overwritten, though *when it can*, + IPython asks for confirmation first. In particular, running the command + "history -f FILENAME" from the IPython Notebook interface will replace + FILENAME even if it already exists *without* confirmation. Examples -------- @@ -801,12 +803,11 @@ def magic_history(self, parameter_s = ''): try: ans = io.ask_yes_no("File %r exists. Overwrite?" % outfname) except StdinNotImplementedError: - print("Overwriting file.") ans = True if not ans: print('Aborting.') return - + print("Overwriting file.") outfile = open(outfname,'w') close_at_end = True diff --git a/IPython/core/magic.py b/IPython/core/magic.py index 39e66b5..950a1e5 100644 --- a/IPython/core/magic.py +++ b/IPython/core/magic.py @@ -984,6 +984,12 @@ Currently the magic system has the following functions:\n""" In [1]: 'a' in _ip.user_ns Out[1]: False + + Notes + ----- + Calling this magic from clients that do not implement standard input, + such as the ipython notebook interface, will reset the namespace + without confirmation. """ opts, args = self.parse_options(parameter_s,'sf') if 'f' in opts: @@ -1056,6 +1062,12 @@ Currently the magic system has the following functions:\n""" In [11]: who_ls Out[11]: ['a'] + + Notes + ----- + Calling this magic from clients that do not implement standard input, + such as the ipython notebook interface, will reset the namespace + without confirmation. """ opts, regex = self.parse_options(parameter_s,'f')