Back to index

python3.2  3.2.2
Classes | Functions
code Namespace Reference

Classes

class  InteractiveInterpreter
class  InteractiveConsole

Functions

def interact

Detailed Description

Utilities needed to emulate Python's interactive interpreter.

Function Documentation

def code.interact (   banner = None,
  readfunc = None,
  local = None 
)
Closely emulate the interactive Python interpreter.

This is a backwards compatible interface to the InteractiveConsole
class.  When readfunc is not specified, it attempts to import the
readline module to enable GNU readline if it is available.

Arguments (all optional, all default to None):

banner -- passed to InteractiveConsole.interact()
readfunc -- if not None, replaces InteractiveConsole.raw_input()
local -- passed to InteractiveInterpreter.__init__()

Definition at line 265 of file code.py.

00265 
00266 def interact(banner=None, readfunc=None, local=None):
00267     """Closely emulate the interactive Python interpreter.
00268 
00269     This is a backwards compatible interface to the InteractiveConsole
00270     class.  When readfunc is not specified, it attempts to import the
00271     readline module to enable GNU readline if it is available.
00272 
00273     Arguments (all optional, all default to None):
00274 
00275     banner -- passed to InteractiveConsole.interact()
00276     readfunc -- if not None, replaces InteractiveConsole.raw_input()
00277     local -- passed to InteractiveInterpreter.__init__()
00278 
00279     """
00280     console = InteractiveConsole(local)
00281     if readfunc is not None:
00282         console.raw_input = readfunc
00283     else:
00284         try:
00285             import readline
00286         except ImportError:
00287             pass
00288     console.interact(banner)
00289 

Here is the caller graph for this function: