IDLE

Source code: Lib/idlelib/ IDLE is Python’s Integrated Development and Learning Environment. IDLE has the following features: coded in 100% pure Python, using the tkinter GUI toolkit cross-platform: works mostly the same on Windows, Unix, and Mac OS X Python shell window (interactive interpreter) with colorizing of code input, output, and error messages multi-window text editor with multiple undo, Python colorizing, smart indent, call tips, auto completion, and other features search within any w

id()

id(object) Return the “identity” of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same id() value. CPython implementation detail: This is the address of the object in memory.

http.server.SimpleHTTPRequestHandler.server_version

server_version This will be "SimpleHTTP/" + __version__, where __version__ is defined at the module level.

http.server.SimpleHTTPRequestHandler.extensions_map

extensions_map A dictionary mapping suffixes into MIME types. The default is signified by an empty string, and is considered to be application/octet-stream. The mapping is used case-insensitively, and so should contain only lower-cased keys.

http.server.SimpleHTTPRequestHandler.do_HEAD()

do_HEAD() This method serves the 'HEAD' request type: it sends the headers it would send for the equivalent GET request. See the do_GET() method for a more complete explanation of the possible headers.

http.server.SimpleHTTPRequestHandler.do_GET()

do_GET() The request is mapped to a local file by interpreting the request as a path relative to the current working directory. If the request was mapped to a directory, the directory is checked for a file named index.html or index.htm (in that order). If found, the file’s contents are returned; otherwise a directory listing is generated by calling the list_directory() method. This method uses os.listdir() to scan the directory, and returns a 404 error response if the listdir() fails. If the

http.server.SimpleHTTPRequestHandler

class http.server.SimpleHTTPRequestHandler(request, client_address, server) This class serves files from the current directory and below, directly mapping the directory structure to HTTP requests. A lot of the work, such as parsing the request, is done by the base class BaseHTTPRequestHandler. This class implements the do_GET() and do_HEAD() functions. The following are defined as class-level attributes of SimpleHTTPRequestHandler: server_version This will be "SimpleHTTP/" + __version__,

http.server.HTTPServer

class http.server.HTTPServer(server_address, RequestHandlerClass) This class builds on the TCPServer class by storing the server address as instance variables named server_name and server_port. The server is accessible by the handler, typically through the handler’s server instance variable.

http.server.CGIHTTPRequestHandler.do_POST()

do_POST() This method serves the 'POST' request type, only allowed for CGI scripts. Error 501, “Can only POST to CGI scripts”, is output when trying to POST to a non-CGI url.

http.server.CGIHTTPRequestHandler.cgi_directories

cgi_directories This defaults to ['/cgi-bin', '/htbin'] and describes directories to treat as containing CGI scripts.