Logo Search packages:      
Sourcecode: ipython version File versions  Download package

def IPython::kernel::core::prompts::CachedOutput::__call__ (   self,
  arg = None 
)

Printing with history cache management.

This is invoked everytime the interpreter needs to print, and is
activated by setting the variable sys.displayhook to it.

Definition at line 488 of file prompts.py.

00488                                :
        """Printing with history cache management.
        
        This is invoked everytime the interpreter needs to print, and is
        activated by setting the variable sys.displayhook to it."""

        # If something injected a '_' variable in __builtin__, delete
        # ipython's automatic one so we don't clobber that.  gettext() in
        # particular uses _, so we need to stay away from it.
        if '_' in __builtin__.__dict__:
            try:
                del self.user_ns['_']
            except KeyError:
                pass
        if arg is not None:
            cout_write = Term.cout.write # fast lookup
            # first handle the cache and counters

            # do not print output if input ends in ';'
            if self.input_hist[self.prompt_count].endswith(';\n'):
                return
            # don't use print, puts an extra space
            cout_write(self.output_sep)
            outprompt = self.shell.hooks.generate_output_prompt()
            if self.do_full_cache:
                cout_write(outprompt)

            # and now call a possibly user-defined print mechanism
            manipulated_val = self.display(arg)
            
            # user display hooks can change the variable to be stored in
            # output history
            
            if manipulated_val is not None:
                arg = manipulated_val
                
            # avoid recursive reference when displaying _oh/Out
            if arg is not self.user_ns['_oh']:
                self.update(arg)

            cout_write(self.output_sep2)
            Term.cout.flush()

    def _display(self,arg):


Generated by  Doxygen 1.6.0   Back to index