def init_python_session():
 from code import InteractiveConsole
 class SymPyConsole(InteractiveConsole, ):
  'An interactive console with readline support. '
  def __init__(self):
   InteractiveConsole.__init__(self)
   try:
    import readline
   except ImportError:
    pass
   else:
    import os
    import atexit
    readline.parse_and_bind('tab: complete')
    if hasattr(readline, 'read_history_file'):
     history = os.path.expanduser('~/.sympy-history')
     try:
      readline.read_history_file(history)
     except IOError:
      pass
     atexit.register(readline.write_history_file, history)
 return SymPyConsole()

def init_python_session ( ) : from code import InteractiveConsole class SymPyConsole ( InteractiveConsole , ) : def __init__ ( self ) : InteractiveConsole . __init__ ( self ) try : import readline except ImportError : pass else : import os import atexit readline . parse_and_bind ( 'tab: complete' ) if hasattr ( readline , 'read_history_file' ) : history = os . path . expanduser ( '~/.sympy-history' ) try : readline . read_history_file ( history ) except IOError : pass atexit . register ( readline . write_history_file , history ) return SymPyConsole ( )
construct new python session .