class_docstr: The custom IPython displayhook to replace sys.displayhook.
  
  This class does many things, but the basic idea is that it is a callable
  that gets called anytime user code returns a value.
class_docstr_tok: ["The","custom","IPython","displayhook","to","replace","sys.displayhook",".","This","class","does","many","things",",","but","the","basic","idea","is","that","it","is","a","callable","that","gets","called","anytime","user","code","returns","a","value","."]
docstr: Update user_ns with various things like _, __, _1, etc.
docstr_tok: ["Update","user_ns","with","various","things","like","_",",","__",",","_1",",","etc","."]
code: def update_user_ns(self, result):
      """Update user_ns with various things like _, __, _1, etc."""
  
      # Avoid recursive reference when displaying _oh/Out
      if result is not self.shell.user_ns["_oh"]:
          if (
              len(self.shell.user_ns["_oh"]) >= self.cache_size
              and self.do_full_cache
          ):
              self.cull_cache()
          # Don't overwrite '_' and friends if '_' is in __builtin__ (otherwise
          # we cause buggy behavior for things like gettext).
  
          if "_" not in builtin_mod.__dict__:
              self.___ = self.__
              self.__ = self._
              self._ = result
              self.shell.push(
                  {"_": self._, "__": self.__, "___": self.___},
                  interactive=False,
              )
  
          # hackish access to top-level  namespace to create _1,_2... dynamically
          to_main = {}
          if self.do_full_cache:
              new_result = "_" + repr(self.prompt_count)
              to_main[new_result] = result
              self.shell.push(to_main, interactive=False)
              self.shell.user_ns["_oh"][self.prompt_count] = result
  
imports: from __future__ import print_function
  import sys
  import io
  import tokenize
  from traitlets.config.configurable import Configurable
  from IPython.utils.py3compat import builtin_mod, cast_unicode_py2
  from traitlets import Instance, Float
  from warnings import warn
label_desc: Use image node_id 9 for calling the DisplayHook obj's underlying member method code with example usage: obj.update_user_ns(result) without return types