def _init_python_printing(stringify_func, **settings):
 import sys
 from sympy.core.compatibility import builtins
 def _displayhook(arg):
  "Python's pretty-printer display hook.\n\n           This function was adapted from:\n\n            http://www.python.org/dev/peps/pep-0217/\n\n        "
  if (arg is not None):
   builtins._ = None
   print(stringify_func(arg, **settings))
   builtins._ = arg
 sys.displayhook = _displayhook

def _init_python_printing ( stringify_func , ** settings ) : import sys from sympy . core . compatibility import builtins def _displayhook ( arg ) : if ( arg is not None ) : builtins . _ = None print ( stringify_func ( arg , ** settings ) ) builtins . _ = arg sys . displayhook = _displayhook
setup printing in python interactive session .