• Main page
  • Global Module Index
  • What's New
    • 1 PEP 218: Built-In Set Objects
    • 2 PEP 237: Unifying Long Integers and Integers
    • 3 PEP 289: Generator Expressions
    • 4 PEP 292: Simpler String Substitutions
    • 5 PEP 318: Decorators for Functions and Methods
    • 6 PEP 322: Reverse Iteration
    • 7 PEP 324: New subprocess Module
    • 8 PEP 327: Decimal Data Type
      • 8.1 Why is Decimal needed?
      • 8.2 The Decimal type
      • 8.3 The Context type
    • 9 PEP 328: Multi-line Imports
    • 10 PEP 331: Locale-Independent Float/String Conversions
    • 11 Other Language Changes
      • 11.1 Optimizations
    • 12 New, Improved, and Deprecated Modules
      • 12.1 cookielib
      • 12.2 doctest
    • 13 Build and C API Changes
      • 13.1 Port-Specific Changes
    • 14 Porting to Python 2.4
    • 15 Acknowledgements
    • About this document ...
  • Tutorial
    • Front Matter
    • 1. Whetting Your Appetite
    • 2. Using the Python Interpreter
      • 2.1 Invoking the Interpreter
        • 2.1.1 Argument Passing
        • 2.1.2 Interactive Mode
      • 2.2 The Interpreter and Its Environment
        • 2.2.1 Error Handling
        • 2.2.2 Executable Python Scripts
        • 2.2.3 Source Code Encoding
        • 2.2.4 The Interactive Startup File
      • 3. An Informal Introduction to Python
        • 3.1 Using Python as a Calculator
          • 3.1.1 Numbers
          • 3.1.2 Strings
          • 3.1.3 Unicode Strings
          • 3.1.4 Lists
        • 3.2 First Steps Towards Programming
      • 4. More Control Flow Tools
        • 4.1 if Statements
        • 4.2 for Statements
        • 4.3 The range() Function
        • 4.4 break and continue Statements, and else Clauses on Loops
        • 4.5 pass Statements
        • 4.6 Defining Functions
        • 4.7 More on Defining Functions
          • 4.7.1 Default Argument Values
          • 4.7.2 Keyword Arguments
          • 4.7.3 Arbitrary Argument Lists
          • 4.7.4 Unpacking Argument Lists
          • 4.7.5 Lambda Forms
          • 4.7.6 Documentation Strings
        • 5. Data Structures
          • 5.1 More on Lists
            • 5.1.1 Using Lists as Stacks
            • 5.1.2 Using Lists as Queues
            • 5.1.3 Functional Programming Tools
            • 5.1.4 List Comprehensions
          • 5.2 The del statement
          • 5.3 Tuples and Sequences
          • 5.4 Sets
          • 5.5 Dictionaries
          • 5.6 Looping Techniques
          • 5.7 More on Conditions
          • 5.8 Comparing Sequences and Other Types
        • 6. Modules
          • 6.1 More on Modules
            • 6.1.1 The Module Search Path
            • 6.1.2 ``Compiled'' Python files
          • 6.2 Standard Modules
          • 6.3 The dir() Function
          • 6.4 Packages
            • 6.4.1 Importing * From a Package
            • 6.4.2 Intra-package References
            • 6.4.3 Packages in Multiple Directories
          • 7. Input and Output
            • 7.1 Fancier Output Formatting
            • 7.2 Reading and Writing Files
              • 7.2.1 Methods of File Objects
              • 7.2.2 The pickle Module
            • 8. Errors and Exceptions
              • 8.1 Syntax Errors
              • 8.2 Exceptions
              • 8.3 Handling Exceptions
              • 8.4 Raising Exceptions
              • 8.5 User-defined Exceptions
              • 8.6 Defining Clean-up Actions
            • 9. Classes
              • 9.1 A Word About Terminology
              • 9.2 Python Scopes and Name Spaces
              • 9.3 A First Look at Classes
                • 9.3.1 Class Definition Syntax
                • 9.3.2 Class Objects
                • 9.3.3 Instance Objects
                • 9.3.4 Method Objects
              • 9.4 Random Remarks
              • 9.5 Inheritance
                • 9.5.1 Multiple Inheritance
              • 9.6 Private Variables
              • 9.7 Odds and Ends
              • 9.8 Exceptions Are Classes Too
              • 9.9 Iterators
              • 9.10 Generators
              • 9.11 Generator Expressions
            • 10. Brief Tour of the Standard Library
              • 10.1 Operating System Interface
              • 10.2 File Wildcards
              • 10.3 Command Line Arguments
              • 10.4 Error Output Redirection and Program Termination
              • 10.5 String Pattern Matching
              • 10.6 Mathematics
              • 10.7 Internet Access
              • 10.8 Dates and Times
              • 10.9 Data Compression
              • 10.10 Performance Measurement
              • 10.11 Quality Control
              • 10.12 Batteries Included
            • 11. Brief Tour of the Standard Library - Part II
              • 11.1 Output Formatting
              • 11.2 Templating
              • 11.3 Working with Binary Data Record Layouts
              • 11.4 Multi-threading
              • 11.5 Logging
              • 11.6 Weak References
              • 11.7 Tools for Working with Lists
              • 11.8 Decimal Floating Point Arithmetic
            • 12. What Now?
            • A. Interactive Input Editing and History Substitution
              • A.1 Line Editing
              • A.2 History Substitution
              • A.3 Key Bindings
              • A.4 Commentary
            • B. Floating Point Arithmetic: Issues and Limitations
              • B.1 Representation Error
            • C. History and License
              • C.1 History of the software
              • C.2 Terms and conditions for accessing or otherwise using Python
              • C.3 Licenses and Acknowledgements for Incorporated Software
                • C.3.1 Mersenne Twister
                • C.3.2 Sockets
                • C.3.3 Floating point exception control
                • C.3.4 MD5 message digest algorithm
                • C.3.5 Asynchronous socket services
                • C.3.6 Cookie management
                • C.3.7 Profiling
                • C.3.8 Execution tracing
                • C.3.9 UUencode and UUdecode functions
                • C.3.10 XML Remote Procedure Calls
              • D. Glossary
              • Index
              • About this document ...
            • Library Reference
              • Front Matter
              • 1. Introduction
              • 2. Built-In Objects
                • 2.1 Built-in Functions
                • 2.2 Non-essential Built-in Functions
                • 2.3 Built-in Types
                  • 2.3.1 Truth Value Testing
                  • 2.3.2 Boolean Operations
                  • 2.3.3 Comparisons
                  • 2.3.4 Numeric Types
                  • 2.3.5 Iterator Types
                  • 2.3.6 Sequence Types
                  • 2.3.7 Set Types
                  • 2.3.8 Mapping Types
                  • 2.3.9 File Objects
                  • 2.3.10 Other Built-in Types
                  • 2.3.11 Special Attributes
                • 2.4 Built-in Exceptions
                • 2.5 Built-in Constants
              • 3. Python Runtime Services
                • 3.1 sys -- System-specific parameters and functions
                • 3.2 gc -- Garbage Collector interface
                • 3.3 weakref -- Weak references
                  • 3.3.1 Weak Reference Objects
                  • 3.3.2 Example
                  • 3.3.3 Weak References in Extension Types
                • 3.4 fpectl -- Floating point exception control
                  • 3.4.1 Example
                  • 3.4.2 Limitations and other considerations
                • 3.5 atexit -- Exit handlers
                  • 3.5.1 atexit Example
                • 3.6 types -- Names for built-in types
                • 3.7 UserDict -- Class wrapper for dictionary objects
                • 3.8 UserList -- Class wrapper for list objects
                • 3.9 UserString -- Class wrapper for string objects
                • 3.10 operator -- Standard operators as functions.
                  • 3.10.1 Mapping Operators to Functions
                • 3.11 inspect -- Inspect live objects
                  • 3.11.1 Types and members
                  • 3.11.2 Retrieving source code
                  • 3.11.3 Classes and functions
                  • 3.11.4 The interpreter stack
                • 3.12 traceback -- Print or retrieve a stack traceback
                  • 3.12.1 Traceback Example
                • 3.13 linecache -- Random access to text lines
                • 3.14 pickle -- Python object serialization
                  • 3.14.1 Relationship to other Python modules
                  • 3.14.2 Data stream format
                  • 3.14.3 Usage
                  • 3.14.4 What can be pickled and unpickled?
                  • 3.14.5 The pickle protocol
                  • 3.14.6 Subclassing Unpicklers
                  • 3.14.7 Example
                • 3.15 cPickle -- A faster pickle
                • 3.16 copy_reg -- Register pickle support functions
                • 3.17 shelve -- Python object persistence
                  • 3.17.1 Restrictions
                  • 3.17.2 Example
                • 3.18 copy -- Shallow and deep copy operations
                • 3.19 marshal -- Internal Python object serialization
                • 3.20 warnings -- Warning control
                  • 3.20.1 Warning Categories
                  • 3.20.2 The Warnings Filter
                  • 3.20.3 Available Functions
                • 3.21 imp -- Access the import internals
                  • 3.21.1 Examples
                • 3.22 pkgutil -- Package extension utility
                • 3.23 code -- Interpreter base classes
                  • 3.23.1 Interactive Interpreter Objects
                  • 3.23.2 Interactive Console Objects
                • 3.24 codeop -- Compile Python code
                • 3.25 pprint -- Data pretty printer
                  • 3.25.1 PrettyPrinter Objects
                • 3.26 repr -- Alternate repr() implementation
                  • 3.26.1 Repr Objects
                  • 3.26.2 Subclassing Repr Objects
                • 3.27 new -- Creation of runtime internal objects
                • 3.28 site -- Site-specific configuration hook
                • 3.29 user -- User-specific configuration hook
                • 3.30 __builtin__ -- Built-in functions
                • 3.31 __main__ -- Top-level script environment
                • 3.32 __future__ -- Future statement definitions
              • 4. String Services
                • 4.1 string -- Common string operations
                  • 4.1.1 String constants
                  • 4.1.2 Template strings
                  • 4.1.3 String functions
                  • 4.1.4 Deprecated string functions
                • 4.2 re -- Regular expression operations
                  • 4.2.1 Regular Expression Syntax
                  • 4.2.2 Matching vs Searching
                  • 4.2.3 Module Contents
                  • 4.2.4 Regular Expression Objects
                  • 4.2.5 Match Objects
                  • 4.2.6 Examples
                • 4.3 struct -- Interpret strings as packed binary data
                • 4.4 difflib -- Helpers for computing deltas
                  • 4.4.1 SequenceMatcher Objects
                  • 4.4.2 SequenceMatcher Examples
                  • 4.4.3 Differ Objects
                  • 4.4.4 Differ Example
                • 4.5 fpformat -- Floating point conversions
                • 4.6 StringIO -- Read and write strings as files
                • 4.7 cStringIO -- Faster version of StringIO
                • 4.8 textwrap -- Text wrapping and filling
                • 4.9 codecs -- Codec registry and base classes
                  • 4.9.1 Codec Base Classes
                  • 4.9.2 Standard Encodings
                  • 4.9.3 encodings.idna -- Internationalized Domain Names in Applications
                • 4.10 unicodedata -- Unicode Database
                • 4.11 stringprep -- Internet String Preparation
              • 5. Miscellaneous Services
                • 5.1 pydoc -- Documentation generator and online help system
                • 5.2 doctest -- Test interactive Python examples
                  • 5.2.1 Simple Usage: Checking Examples in Docstrings
                  • 5.2.2 Simple Usage: Checking Examples in a Text File
                  • 5.2.3 How It Works
                  • 5.2.4 Basic API
                  • 5.2.5 Unittest API
                  • 5.2.6 Advanced API
                  • 5.2.7 Debugging
                  • 5.2.8 Soapbox
                • 5.3 unittest -- Unit testing framework
                  • 5.3.1 Basic example
                  • 5.3.2 Organizing test code
                  • 5.3.3 Re-using old test code
                  • 5.3.4 Classes and functions
                  • 5.3.5 TestCase Objects
                  • 5.3.6 TestSuite Objects
                  • 5.3.7 TestResult Objects
                  • 5.3.8 TestLoader Objects
                • 5.4 test -- Regression tests package for Python
                  • 5.4.1 Writing Unit Tests for the test package
                  • 5.4.2 Running tests using test.regrtest
                • 5.5 test.test_support -- Utility functions for tests
                • 5.6 decimal -- Decimal floating point arithmetic
                  • 5.6.1 Quick-start Tutorial
                  • 5.6.2 Decimal objects
                  • 5.6.3 Context objects
                  • 5.6.4 Signals
                  • 5.6.5 Floating Point Notes
                  • 5.6.6 Working with threads
                  • 5.6.7 Recipes
                • 5.7 math -- Mathematical functions
                • 5.8 cmath -- Mathematical functions for complex numbers
                • 5.9 random -- Generate pseudo-random numbers
                • 5.10 whrandom -- Pseudo-random number generator
                • 5.11 bisect -- Array bisection algorithm
                  • 5.11.1 Examples
                • 5.12 collections -- High-performance container datatypes
                  • 5.12.1 Recipes
                • 5.13 heapq -- Heap queue algorithm
                  • 5.13.1 Theory
                • 5.14 array -- Efficient arrays of numeric values
                • 5.15 sets -- Unordered collections of unique elements
                  • 5.15.1 Set Objects
                  • 5.15.2 Example
                  • 5.15.3 Protocol for automatic conversion to immutable
                • 5.16 itertools -- Functions creating iterators for efficient looping
                  • 5.16.1 Itertool functions
                  • 5.16.2 Examples
                  • 5.16.3 Recipes
                • 5.17 ConfigParser -- Configuration file parser
                  • 5.17.1 RawConfigParser Objects
                  • 5.17.2 ConfigParser Objects
                  • 5.17.3 SafeConfigParser Objects
                • 5.18 fileinput -- Iterate over lines from multiple input streams
                • 5.19 calendar -- General calendar-related functions
                • 5.20 cmd -- Support for line-oriented command interpreters
                  • 5.20.1 Cmd Objects
                • 5.21 shlex -- Simple lexical analysis
                  • 5.21.1 shlex Objects
                  • 5.21.2 Parsing Rules
                • 6. Generic Operating System Services
                  • 6.1 os -- Miscellaneous operating system interfaces
                    • 6.1.1 Process Parameters
                    • 6.1.2 File Object Creation
                    • 6.1.3 File Descriptor Operations
                    • 6.1.4 Files and Directories
                    • 6.1.5 Process Management
                    • 6.1.6 Miscellaneous System Information
                    • 6.1.7 Miscellaneous Functions
                  • 6.2 os.path -- Common pathname manipulations
                  • 6.3 dircache -- Cached directory listings
                  • 6.4 stat -- Interpreting stat() results
                  • 6.5 statcache -- An optimization of os.stat()
                  • 6.6 statvfs -- Constants used with os.statvfs()
                  • 6.7 filecmp -- File and Directory Comparisons
                    • 6.7.1 The dircmp class
                  • 6.8 subprocess -- Subprocess management
                    • 6.8.1 Using the subprocess Module
                    • 6.8.2 Popen Objects
                    • 6.8.3 Replacing Older Functions with the subprocess Module
                  • 6.9 popen2 -- Subprocesses with accessible I/O streams
                    • 6.9.1 Popen3 and Popen4 Objects
                    • 6.9.2 Flow Control Issues
                  • 6.10 datetime -- Basic date and time types
                    • 6.10.1 Available Types
                    • 6.10.2 timedelta Objects
                    • 6.10.3 date Objects
                    • 6.10.4 datetime Objects
                    • 6.10.5 time Objects
                    • 6.10.6 tzinfo Objects
                    • 6.10.7 strftime() Behavior
                  • 6.11 time -- Time access and conversions
                  • 6.12 sched -- Event scheduler
                    • 6.12.1 Scheduler Objects
                  • 6.13 mutex -- Mutual exclusion support
                    • 6.13.1 Mutex Objects
                  • 6.14 getpass -- Portable password input
                  • 6.15 curses -- Terminal handling for character-cell displays
                    • 6.15.1 Functions
                    • 6.15.2 Window Objects
                    • 6.15.3 Constants
                  • 6.16 curses.textpad -- Text input widget for curses programs
                    • 6.16.1 Textbox objects
                  • 6.17 curses.wrapper -- Terminal handler for curses programs
                  • 6.18 curses.ascii -- Utilities for ASCII characters
                  • 6.19 curses.panel -- A panel stack extension for curses.
                    • 6.19.1 Functions
                    • 6.19.2 Panel Objects
                  • 6.20 getopt -- Parser for command line options
                  • 6.21 optparse -- More powerful command line option parser
                    • 6.21.1 Background
                    • 6.21.2 Tutorial
                    • 6.21.3 Reference Guide
                    • 6.21.4 Option Callbacks
                  • 6.22 tempfile -- Generate temporary files and directories
                  • 6.23 errno -- Standard errno system symbols
                  • 6.24 glob -- Unix style pathname pattern expansion
                  • 6.25 fnmatch -- Unix filename pattern matching
                  • 6.26 shutil -- High-level file operations
                    • 6.26.1 Example
                  • 6.27 locale -- Internationalization services
                    • 6.27.1 Background, details, hints, tips and caveats
                    • 6.27.2 For extension writers and programs that embed Python
                    • 6.27.3 Access to message catalogs
                  • 6.28 gettext -- Multilingual internationalization services
                    • 6.28.1 GNU gettext API
                    • 6.28.2 Class-based API
                    • 6.28.3 Internationalizing your programs and modules
                    • 6.28.4 Acknowledgements
                  • 6.29 logging -- Logging facility for Python
                    • 6.29.1 Logger Objects
                    • 6.29.2 Basic example
                    • 6.29.3 Logging to multiple destinations
                    • 6.29.4 Sending and receiving logging events across a network
                    • 6.29.5 Handler Objects
                    • 6.29.6 Formatter Objects
                    • 6.29.7 Filter Objects
                    • 6.29.8 LogRecord Objects
                    • 6.29.9 Thread Safety
                    • 6.29.10 Configuration
                  • 6.30 platform -- Access to underlying platform's identifying data.
                    • 6.30.1 Cross Platform
                    • 6.30.2 Java Platform
                    • 6.30.3 Windows Platform
                    • 6.30.4 Mac OS Platform
                    • 6.30.5 Unix Platforms
                  • 7. Optional Operating System Services
                    • 7.1 signal -- Set handlers for asynchronous events
                      • 7.1.1 Example
                    • 7.2 socket -- Low-level networking interface
                      • 7.2.1 Socket Objects
                      • 7.2.2 SSL Objects
                      • 7.2.3 Example
                    • 7.3 select -- Waiting for I/O completion
                      • 7.3.1 Polling Objects
                    • 7.4 thread -- Multiple threads of control
                    • 7.5 threading -- Higher-level threading interface
                      • 7.5.1 Lock Objects
                      • 7.5.2 RLock Objects
                      • 7.5.3 Condition Objects
                      • 7.5.4 Semaphore Objects
                      • 7.5.5 Event Objects
                      • 7.5.6 Thread Objects
                      • 7.5.7 Timer Objects
                    • 7.6 dummy_thread -- Drop-in replacement for the thread module
                    • 7.7 dummy_threading -- Drop-in replacement for the threading module
                    • 7.8 Queue -- A synchronized queue class
                      • 7.8.1 Queue Objects
                    • 7.9 mmap -- Memory-mapped file support
                    • 7.10 anydbm -- Generic access to DBM-style databases
                    • 7.11 dbhash -- DBM-style interface to the BSD database library
                      • 7.11.1 Database Objects
                    • 7.12 whichdb -- Guess which DBM module created a database
                    • 7.13 bsddb -- Interface to Berkeley DB library
                      • 7.13.1 Hash, BTree and Record Objects
                    • 7.14 dumbdbm -- Portable DBM implementation
                      • 7.14.1 Dumbdbm Objects
                    • 7.15 zlib -- Compression compatible with gzip
                    • 7.16 gzip -- Support for gzip files
                    • 7.17 bz2 -- Compression compatible with bzip2
                      • 7.17.1 (De)compression of files
                      • 7.17.2 Sequential (de)compression
                      • 7.17.3 One-shot (de)compression
                    • 7.18 zipfile -- Work with ZIP archives
                      • 7.18.1 ZipFile Objects
                      • 7.18.2 PyZipFile Objects
                      • 7.18.3 ZipInfo Objects
                    • 7.19 tarfile -- Read and write tar archive files
                      • 7.19.1 TarFile Objects
                      • 7.19.2 TarInfo Objects
                      • 7.19.3 Examples
                    • 7.20 readline -- GNU readline interface
                      • 7.20.1 Example
                    • 7.21 rlcompleter -- Completion function for GNU readline
                      • 7.21.1 Completer Objects
                    • 8. Unix Specific Services
                      • 8.1 posix -- The most common POSIX system calls
                        • 8.1.1 Large File Support
                        • 8.1.2 Module Contents
                      • 8.2 pwd -- The password database
                      • 8.3 grp -- The group database
                      • 8.4 crypt -- Function to check Unix passwords
                      • 8.5 dl -- Call C functions in shared objects
                        • 8.5.1 Dl Objects
                      • 8.6 dbm -- Simple ``database'' interface
                      • 8.7 gdbm -- GNU's reinterpretation of dbm
                      • 8.8 termios -- POSIX style tty control
                        • 8.8.1 Example
                      • 8.9 tty -- Terminal control functions
                      • 8.10 pty -- Pseudo-terminal utilities
                      • 8.11 fcntl -- The fcntl() and ioctl() system calls
                      • 8.12 pipes -- Interface to shell pipelines
                        • 8.12.1 Template Objects
                      • 8.13 posixfile -- File-like objects with locking support
                      • 8.14 resource -- Resource usage information
                        • 8.14.1 Resource Limits
                        • 8.14.2 Resource Usage
                      • 8.15 nis -- Interface to Sun's NIS (Yellow Pages)
                      • 8.16 syslog -- Unix syslog library routines
                      • 8.17 commands -- Utilities for running commands
                    • 9. The Python Debugger
                      • 9.1 Debugger Commands
                      • 9.2 How It Works
                    • 10. The Python Profiler
                      • 10.1 Introduction to the profiler
                      • 10.2 How Is This Profiler Different From The Old Profiler?
                      • 10.3 Instant Users Manual
                      • 10.4 What Is Deterministic Profiling?
                      • 10.5 Reference Manual
                        • 10.5.1 The Stats Class
                      • 10.6 Limitations
                      • 10.7 Calibration
                      • 10.8 Extensions -- Deriving Better Profilers
                      • 10.9 hotshot -- High performance logging profiler
                        • 10.9.1 Profile Objects
                        • 10.9.2 Using hotshot data
                        • 10.9.3 Example Usage
                      • 10.10 timeit -- Measure execution time of small code snippets
                        • 10.10.1 Command Line Interface
                        • 10.10.2 Examples
                      • 11. Internet Protocols and Support
                        • 11.1 webbrowser -- Convenient Web-browser controller
                          • 11.1.1 Browser Controller Objects
                        • 11.2 cgi -- Common Gateway Interface support.
                          • 11.2.1 Introduction
                          • 11.2.2 Using the cgi module
                          • 11.2.3 Higher Level Interface
                          • 11.2.4 Old classes
                          • 11.2.5 Functions
                          • 11.2.6 Caring about security
                          • 11.2.7 Installing your CGI script on a Unix system
                          • 11.2.8 Testing your CGI script
                          • 11.2.9 Debugging CGI scripts
                          • 11.2.10 Common problems and solutions
                        • 11.3 cgitb -- Traceback manager for CGI scripts
                        • 11.4 urllib -- Open arbitrary resources by URL
                          • 11.4.1 URLopener Objects
                          • 11.4.2 Examples
                        • 11.5 urllib2 -- extensible library for opening URLs
                          • 11.5.1 Request Objects
                          • 11.5.2 OpenerDirector Objects
                          • 11.5.3 BaseHandler Objects
                          • 11.5.4 HTTPRedirectHandler Objects
                          • 11.5.5 HTTPCookieProcessor Objects
                          • 11.5.6 ProxyHandler Objects
                          • 11.5.7 HTTPPasswordMgr Objects
                          • 11.5.8 AbstractBasicAuthHandler Objects
                          • 11.5.9 HTTPBasicAuthHandler Objects
                          • 11.5.10 ProxyBasicAuthHandler Objects
                          • 11.5.11 AbstractDigestAuthHandler Objects
                          • 11.5.12 HTTPDigestAuthHandler Objects
                          • 11.5.13 ProxyDigestAuthHandler Objects
                          • 11.5.14 HTTPHandler Objects
                          • 11.5.15 HTTPSHandler Objects
                          • 11.5.16 FileHandler Objects
                          • 11.5.17 FTPHandler Objects
                          • 11.5.18 CacheFTPHandler Objects
                          • 11.5.19 GopherHandler Objects
                          • 11.5.20 UnknownHandler Objects
                          • 11.5.21 HTTPErrorProcessor Objects
                          • 11.5.22 Examples
                        • 11.6 httplib -- HTTP protocol client
                          • 11.6.1 HTTPConnection Objects
                          • 11.6.2 HTTPResponse Objects
                          • 11.6.3 Examples
                        • 11.7 ftplib -- FTP protocol client
                          • 11.7.1 FTP Objects
                        • 11.8 gopherlib -- Gopher protocol client
                        • 11.9 poplib -- POP3 protocol client
                          • 11.9.1 POP3 Objects
                          • 11.9.2 POP3 Example
                        • 11.10 imaplib -- IMAP4 protocol client
                          • 11.10.1 IMAP4 Objects
                          • 11.10.2 IMAP4 Example
                        • 11.11 nntplib -- NNTP protocol client
                          • 11.11.1 NNTP Objects
                        • 11.12 smtplib -- SMTP protocol client
                          • 11.12.1 SMTP Objects
                          • 11.12.2 SMTP Example
                        • 11.13 smtpd -- SMTP Server
                          • 11.13.1 SMTPServer Objects
                          • 11.13.2 DebuggingServer Objects
                          • 11.13.3 PureProxy Objects
                          • 11.13.4 MailmanProxy Objects
                        • 11.14 telnetlib -- Telnet client
                          • 11.14.1 Telnet Objects
                          • 11.14.2 Telnet Example
                        • 11.15 urlparse -- Parse URLs into components
                        • 11.16 SocketServer -- A framework for network servers
                        • 11.17 BaseHTTPServer -- Basic HTTP server
                        • 11.18 SimpleHTTPServer -- Simple HTTP request handler
                        • 11.19 CGIHTTPServer -- CGI-capable HTTP request handler
                        • 11.20 cookielib -- Cookie handling for HTTP clients
                          • 11.20.1 CookieJar and FileCookieJar Objects
                          • 11.20.2 FileCookieJar subclasses and co-operation with web browsers
                          • 11.20.3 CookiePolicy Objects
                          • 11.20.4 DefaultCookiePolicy Objects
                          • 11.20.5 Cookie Objects
                          • 11.20.6 Examples
                        • 11.21 Cookie -- HTTP state management
                          • 11.21.1 Cookie Objects
                          • 11.21.2 Morsel Objects
                          • 11.21.3 Example
                        • 11.22 xmlrpclib -- XML-RPC client access
                          • 11.22.1 ServerProxy Objects
                          • 11.22.2 Boolean Objects
                          • 11.22.3 DateTime Objects
                          • 11.22.4 Binary Objects
                          • 11.22.5 Fault Objects
                          • 11.22.6 ProtocolError Objects
                          • 11.22.7 MultiCall Objects
                          • 11.22.8 Convenience Functions
                          • 11.22.9 Example of Client Usage
                        • 11.23 SimpleXMLRPCServer -- Basic XML-RPC server
                          • 11.23.1 SimpleXMLRPCServer Objects
                          • 11.23.2 CGIXMLRPCRequestHandler
                        • 11.24 DocXMLRPCServer -- Self-documenting XML-RPC server
                          • 11.24.1 DocXMLRPCServer Objects
                          • 11.24.2 DocCGIXMLRPCRequestHandler
                        • 11.25 asyncore -- Asynchronous socket handler
                          • 11.25.1 asyncore Example basic HTTP client
                        • 11.26 asynchat -- Asynchronous socket command/response handler
                          • 11.26.1 asynchat - Auxiliary Classes and Functions
                          • 11.26.2 asynchat Example
                        • 12. Internet Data Handling
                          • 12.1 formatter -- Generic output formatting
                            • 12.1.1 The Formatter Interface
                            • 12.1.2 Formatter Implementations
                            • 12.1.3 The Writer Interface
                            • 12.1.4 Writer Implementations
                          • 12.2 email -- An email and MIME handling package
                            • 12.2.1 Representing an email message
                            • 12.2.2 Parsing email messages
                            • 12.2.3 Generating MIME documents
                            • 12.2.4 Creating email and MIME objects from scratch
                            • 12.2.5 Internationalized headers
                            • 12.2.6 Representing character sets
                            • 12.2.7 Encoders
                            • 12.2.8 Exception and Defect classes
                            • 12.2.9 Miscellaneous utilities
                            • 12.2.10 Iterators
                            • 12.2.11 Package History
                            • 12.2.12 Differences from mimelib
                            • 12.2.13 Examples
                          • 12.3 mailcap -- Mailcap file handling.
                          • 12.4 mailbox -- Read various mailbox formats
                            • 12.4.1 Mailbox Objects
                          • 12.5 mhlib -- Access to MH mailboxes
                            • 12.5.1 MH Objects
                            • 12.5.2 Folder Objects
                            • 12.5.3 Message Objects
                          • 12.6 mimetools -- Tools for parsing MIME messages
                            • 12.6.1 Additional Methods of Message Objects
                          • 12.7 mimetypes -- Map filenames to MIME types
                            • 12.7.1 MimeTypes Objects
                          • 12.8 MimeWriter -- Generic MIME file writer
                            • 12.8.1 MimeWriter Objects
                          • 12.9 mimify -- MIME processing of mail messages
                          • 12.10 multifile -- Support for files containing distinct parts
                            • 12.10.1 MultiFile Objects
                            • 12.10.2 MultiFile Example
                          • 12.11 rfc822 -- Parse RFC 2822 mail headers
                            • 12.11.1 Message Objects
                            • 12.11.2 AddressList Objects
                          • 12.12 base64 -- RFC 3548: Base16, Base32, Base64 Data Encodings
                          • 12.13 binascii -- Convert between binary and ASCII
                          • 12.14 binhex -- Encode and decode binhex4 files
                            • 12.14.1 Notes
                          • 12.15 quopri -- Encode and decode MIME quoted-printable data
                          • 12.16 uu -- Encode and decode uuencode files
                          • 12.17 xdrlib -- Encode and decode XDR data
                            • 12.17.1 Packer Objects
                            • 12.17.2 Unpacker Objects
                            • 12.17.3 Exceptions
                          • 12.18 netrc -- netrc file processing
                            • 12.18.1 netrc Objects
                          • 12.19 robotparser -- Parser for robots.txt
                          • 12.20 csv -- CSV File Reading and Writing
                            • 12.20.1 Module Contents
                            • 12.20.2 Dialects and Formatting Parameters
                            • 12.20.3 Reader Objects
                            • 12.20.4 Writer Objects
                            • 12.20.5 Examples
                          • 13. Structured Markup Processing Tools
                            • 13.1 HTMLParser -- Simple HTML and XHTML parser
                              • 13.1.1 Example HTML Parser Application
                            • 13.2 sgmllib -- Simple SGML parser
                            • 13.3 htmllib -- A parser for HTML documents
                              • 13.3.1 HTMLParser Objects
                            • 13.4 htmlentitydefs -- Definitions of HTML general entities
                            • 13.5 xml.parsers.expat -- Fast XML parsing using Expat
                              • 13.5.1 XMLParser Objects
                              • 13.5.2 ExpatError Exceptions
                              • 13.5.3 Example
                              • 13.5.4 Content Model Descriptions
                              • 13.5.5 Expat error constants
                            • 13.6 xml.dom -- The Document Object Model API
                              • 13.6.1 Module Contents
                              • 13.6.2 Objects in the DOM
                              • 13.6.3 Conformance
                            • 13.7 xml.dom.minidom -- Lightweight DOM implementation
                              • 13.7.1 DOM Objects
                              • 13.7.2 DOM Example
                              • 13.7.3 minidom and the DOM standard
                            • 13.8 xml.dom.pulldom -- Support for building partial DOM trees
                              • 13.8.1 DOMEventStream Objects
                            • 13.9 xml.sax -- Support for SAX2 parsers
                              • 13.9.1 SAXException Objects
                            • 13.10 xml.sax.handler -- Base classes for SAX handlers
                              • 13.10.1 ContentHandler Objects
                              • 13.10.2 DTDHandler Objects
                              • 13.10.3 EntityResolver Objects
                              • 13.10.4 ErrorHandler Objects
                            • 13.11 xml.sax.saxutils -- SAX Utilities
                            • 13.12 xml.sax.xmlreader -- Interface for XML parsers
                              • 13.12.1 XMLReader Objects
                              • 13.12.2 IncrementalParser Objects
                              • 13.12.3 Locator Objects
                              • 13.12.4 InputSource Objects
                              • 13.12.5 The Attributes Interface
                              • 13.12.6 The AttributesNS Interface
                            • 13.13 xmllib -- A parser for XML documents
                              • 13.13.1 XML Namespaces
                            • 14. Multimedia Services
                              • 14.1 audioop -- Manipulate raw audio data
                              • 14.2 imageop -- Manipulate raw image data
                              • 14.3 aifc -- Read and write AIFF and AIFC files
                              • 14.4 sunau -- Read and write Sun AU files
                                • 14.4.1 AU_read Objects
                                • 14.4.2 AU_write Objects
                              • 14.5 wave -- Read and write WAV files
                                • 14.5.1 Wave_read Objects
                                • 14.5.2 Wave_write Objects
                              • 14.6 chunk -- Read IFF chunked data
                              • 14.7 colorsys -- Conversions between color systems
                              • 14.8 rgbimg -- Read and write ``SGI RGB'' files
                              • 14.9 imghdr -- Determine the type of an image
                              • 14.10 sndhdr -- Determine type of sound file
                              • 14.11 ossaudiodev -- Access to OSS-compatible audio devices
                                • 14.11.1 Audio Device Objects
                                • 14.11.2 Mixer Device Objects
                              • 15. Cryptographic Services
                                • 15.1 hmac -- Keyed-Hashing for Message Authentication
                                • 15.2 md5 -- MD5 message digest algorithm
                                • 15.3 sha -- SHA-1 message digest algorithm
                              • 16. Graphical User Interfaces with Tk
                                • 16.1 Tkinter -- Python interface to Tcl/Tk
                                  • 16.1.1 Tkinter Modules
                                  • 16.1.2 Tkinter Life Preserver
                                  • 16.1.3 A (Very) Quick Look at Tcl/Tk
                                  • 16.1.4 Mapping Basic Tk into Tkinter
                                  • 16.1.5 How Tk and Tkinter are Related
                                  • 16.1.6 Handy Reference
                                • 16.2 Tix -- Extension widgets for Tk
                                  • 16.2.1 Using Tix
                                  • 16.2.2 Tix Widgets
                                  • 16.2.3 Tix Commands
                                • 16.3 ScrolledText -- Scrolled Text Widget
                                • 16.4 turtle -- Turtle graphics for Tk
                                  • 16.4.1 Pen and RawPen Objects
                                • 16.5 Idle
                                  • 16.5.1 Menus
                                  • 16.5.2 Basic editing and navigation
                                  • 16.5.3 Syntax colors
                                • 16.6 Other Graphical User Interface Packages
                              • 17. Restricted Execution
                                • 17.1 rexec -- Restricted execution framework
                                  • 17.1.1 RExec Objects
                                  • 17.1.2 Defining restricted environments
                                  • 17.1.3 An example
                                • 17.2 Bastion -- Restricting access to objects
                              • 18. Python Language Services
                                • 18.1 parser -- Access Python parse trees
                                  • 18.1.1 Creating AST Objects
                                  • 18.1.2 Converting AST Objects
                                  • 18.1.3 Queries on AST Objects
                                  • 18.1.4 Exceptions and Error Handling
                                  • 18.1.5 AST Objects
                                  • 18.1.6 Examples
                                • 18.2 symbol -- Constants used with Python parse trees
                                • 18.3 token -- Constants used with Python parse trees
                                • 18.4 keyword -- Testing for Python keywords
                                • 18.5 tokenize -- Tokenizer for Python source
                                • 18.6 tabnanny -- Detection of ambiguous indentation
                                • 18.7 pyclbr -- Python class browser support
                                  • 18.7.1 Class Descriptor Objects
                                  • 18.7.2 Function Descriptor Objects
                                • 18.8 py_compile -- Compile Python source files
                                • 18.9 compileall -- Byte-compile Python libraries
                                • 18.10 dis -- Disassembler for Python byte code
                                  • 18.10.1 Python Byte Code Instructions
                                • 18.11 pickletools -- Tools for pickle developers.
                                • 18.12 distutils -- Building and installing Python modules
                              • 19. Python compiler package
                                • 19.1 The basic interface
                                • 19.2 Limitations
                                • 19.3 Python Abstract Syntax
                                  • 19.3.1 AST Nodes
                                  • 19.3.2 Assignment nodes
                                  • 19.3.3 Examples
                                • 19.4 Using Visitors to Walk ASTs
                                • 19.5 Bytecode Generation
                              • 20. SGI IRIX Specific Services
                                • 20.1 al -- Audio functions on the SGI
                                  • 20.1.1 Configuration Objects
                                  • 20.1.2 Port Objects
                                • 20.2 AL -- Constants used with the al module
                                • 20.3 cd -- CD-ROM access on SGI systems
                                  • 20.3.1 Player Objects
                                  • 20.3.2 Parser Objects
                                • 20.4 fl -- FORMS library for graphical user interfaces
                                  • 20.4.1 Functions Defined in Module fl
                                  • 20.4.2 Form Objects
                                  • 20.4.3 FORMS Objects
                                • 20.5 FL -- Constants used with the fl module
                                • 20.6 flp -- Functions for loading stored FORMS designs
                                • 20.7 fm -- Font Manager interface
                                • 20.8 gl -- Graphics Library interface
                                • 20.9 DEVICE -- Constants used with the gl module
                                • 20.10 GL -- Constants used with the gl module
                                • 20.11 imgfile -- Support for SGI imglib files
                                • 20.12 jpeg -- Read and write JPEG files
                              • 21. SunOS Specific Services
                                • 21.1 sunaudiodev -- Access to Sun audio hardware
                                  • 21.1.1 Audio Device Objects
                                • 21.2 SUNAUDIODEV -- Constants used with sunaudiodev
                              • 22. MS Windows Specific Services
                                • 22.1 msvcrt - Useful routines from the MS VC++ runtime
                                  • 22.1.1 File Operations
                                  • 22.1.2 Console I/O
                                  • 22.1.3 Other Functions
                                • 22.2 _winreg - Windows registry access
                                  • 22.2.1 Registry Handle Objects
                                • 22.3 winsound -- Sound-playing interface for Windows
                              • A. Undocumented Modules
                                • A.1 Frameworks
                                • A.2 Miscellaneous useful utilities
                                • A.3 Platform specific modules
                                • A.4 Multimedia
                                • A.5 Obsolete
                                • A.6 SGI-specific Extension modules
                              • B. Reporting Bugs
                              • C. History and License
                                • C.1 History of the software
                                • C.2 Terms and conditions for accessing or otherwise using Python
                                • C.3 Licenses and Acknowledgements for Incorporated Software
                                  • C.3.1 Mersenne Twister
                                  • C.3.2 Sockets
                                  • C.3.3 Floating point exception control
                                  • C.3.4 MD5 message digest algorithm
                                  • C.3.5 Asynchronous socket services
                                  • C.3.6 Cookie management
                                  • C.3.7 Profiling
                                  • C.3.8 Execution tracing
                                  • C.3.9 UUencode and UUdecode functions
                                  • C.3.10 XML Remote Procedure Calls
                                • Module Index
                                • Index
                                • About this document ...
                              • Language Reference
                                • Front Matter
                                • 1. Introduction
                                  • 1.1 Notation
                                • 2. Lexical analysis
                                  • 2.1 Line structure
                                    • 2.1.1 Logical lines
                                    • 2.1.2 Physical lines
                                    • 2.1.3 Comments
                                    • 2.1.4 Encoding declarations
                                    • 2.1.5 Explicit line joining
                                    • 2.1.6 Implicit line joining
                                    • 2.1.7 Blank lines
                                    • 2.1.8 Indentation
                                    • 2.1.9 Whitespace between tokens
                                  • 2.2 Other tokens
                                  • 2.3 Identifiers and keywords
                                    • 2.3.1 Keywords
                                    • 2.3.2 Reserved classes of identifiers
                                  • 2.4 Literals
                                    • 2.4.1 String literals
                                    • 2.4.2 String literal concatenation
                                    • 2.4.3 Numeric literals
                                    • 2.4.4 Integer and long integer literals
                                    • 2.4.5 Floating point literals
                                    • 2.4.6 Imaginary literals
                                  • 2.5 Operators
                                  • 2.6 Delimiters
                                • 3. Data model
                                  • 3.1 Objects, values and types
                                  • 3.2 The standard type hierarchy
                                  • 3.3 Special method names
                                    • 3.3.1 Basic customization
                                    • 3.3.2 Customizing attribute access
                                    • 3.3.3 Customizing class creation
                                    • 3.3.4 Emulating callable objects
                                    • 3.3.5 Emulating container types
                                    • 3.3.6 Additional methods for emulation of sequence types
                                    • 3.3.7 Emulating numeric types
                                    • 3.3.8 Coercion rules
                                  • 4. Execution model
                                    • 4.1 Naming and binding
                                      • 4.1.1 Interaction with dynamic features
                                    • 4.2 Exceptions
                                  • 5. Expressions
                                    • 5.1 Arithmetic conversions
                                    • 5.2 Atoms
                                      • 5.2.1 Identifiers (Names)
                                      • 5.2.2 Literals
                                      • 5.2.3 Parenthesized forms
                                      • 5.2.4 List displays
                                      • 5.2.5 Generator expressions
                                      • 5.2.6 Dictionary displays
                                      • 5.2.7 String conversions
                                    • 5.3 Primaries
                                      • 5.3.1 Attribute references
                                      • 5.3.2 Subscriptions
                                      • 5.3.3 Slicings
                                      • 5.3.4 Calls
                                    • 5.4 The power operator
                                    • 5.5 Unary arithmetic operations
                                    • 5.6 Binary arithmetic operations
                                    • 5.7 Shifting operations
                                    • 5.8 Binary bit-wise operations
                                    • 5.9 Comparisons
                                    • 5.10 Boolean operations
                                    • 5.11 Lambdas
                                    • 5.12 Expression lists
                                    • 5.13 Evaluation order
                                    • 5.14 Summary
                                  • 6. Simple statements
                                    • 6.1 Expression statements
                                    • 6.2 Assert statements
                                    • 6.3 Assignment statements
                                      • 6.3.1 Augmented assignment statements
                                    • 6.4 The pass statement
                                    • 6.5 The del statement
                                    • 6.6 The print statement
                                    • 6.7 The return statement
                                    • 6.8 The yield statement
                                    • 6.9 The raise statement
                                    • 6.10 The break statement
                                    • 6.11 The continue statement
                                    • 6.12 The import statement
                                      • 6.12.1 Future statements
                                    • 6.13 The global statement
                                    • 6.14 The exec statement
                                  • 7. Compound statements
                                    • 7.1 The if statement
                                    • 7.2 The while statement
                                    • 7.3 The for statement
                                    • 7.4 The try statement
                                    • 7.5 Function definitions
                                    • 7.6 Class definitions
                                  • 8. Top-level components
                                    • 8.1 Complete Python programs
                                    • 8.2 File input
                                    • 8.3 Interactive input
                                    • 8.4 Expression input
                                  • A. History and License
                                    • A.1 History of the software
                                    • A.2 Terms and conditions for accessing or otherwise using Python
                                    • A.3 Licenses and Acknowledgements for Incorporated Software
                                      • A.3.1 Mersenne Twister
                                      • A.3.2 Sockets
                                      • A.3.3 Floating point exception control
                                      • A.3.4 MD5 message digest algorithm
                                      • A.3.5 Asynchronous socket services
                                      • A.3.6 Cookie management
                                      • A.3.7 Profiling
                                      • A.3.8 Execution tracing
                                      • A.3.9 UUencode and UUdecode functions
                                      • A.3.10 XML Remote Procedure Calls
                                    • Index
                                    • About this document ...
                                  • Macintosh Reference
                                    • Front Matter
                                    • 1. Using Python on a Mac OS 9 Macintosh
                                      • 1.1 Getting and Installing MacPython-OSX
                                        • 1.1.1 How to run a Python script
                                        • 1.1.2 Running scripts with a GUI
                                        • 1.1.3 configuration
                                      • 1.2 Getting and Installing MacPython-OS9
                                        • 1.2.1 Entering the interactive Interpreter
                                        • 1.2.2 How to run a Python script
                                        • 1.2.3 Simulating command line arguments
                                        • 1.2.4 Creating a Python script
                                        • 1.2.5 Configuration
                                      • 1.3 The IDE
                                        • 1.3.1 Using the ``Python Interactive'' window
                                        • 1.3.2 Writing a Python Script
                                        • 1.3.3 Executing a script from within the IDE
                                        • 1.3.4 ``Save as'' versus ``Save as Applet''
                                      • 2. MacPython Modules
                                        • 2.1 mac -- Implementations for the os module
                                        • 2.2 macpath -- MacOS path manipulation functions
                                        • 2.3 macfs -- Various file system services
                                          • 2.3.1 FSSpec Objects
                                          • 2.3.2 Alias Objects
                                          • 2.3.3 FInfo Objects
                                        • 2.4 ic -- Access to Internet Config
                                          • 2.4.1 IC Objects
                                        • 2.5 MacOS -- Access to Mac OS interpreter features
                                        • 2.6 macostools -- Convenience routines for file manipulation
                                        • 2.7 findertools -- The finder's Apple Events interface
                                        • 2.8 EasyDialogs -- Basic Macintosh dialogs
                                          • 2.8.1 ProgressBar Objects
                                        • 2.9 FrameWork -- Interactive application framework
                                          • 2.9.1 Application Objects
                                          • 2.9.2 Window Objects
                                          • 2.9.3 ControlsWindow Object
                                          • 2.9.4 ScrolledWindow Object
                                          • 2.9.5 DialogWindow Objects
                                        • 2.10 autoGIL -- Global Interpreter Lock handling in event loops
                                      • 3. MacPython OSA Modules
                                        • 3.1 gensuitemodule -- Generate OSA stub packages
                                        • 3.2 aetools -- OSA client support
                                        • 3.3 aepack -- Conversion between Python variables and AppleEvent data containers
                                        • 3.4 aetypes -- AppleEvent objects
                                        • 3.5 MiniAEFrame -- Open Scripting Architecture server support
                                          • 3.5.1 AEServer Objects
                                        • 4. MacOS Toolbox Modules
                                          • 4.1 Carbon.AE -- Apple Events
                                          • 4.2 Carbon.AH -- Apple Help
                                          • 4.3 Carbon.App -- Appearance Manager
                                          • 4.4 Carbon.CF -- Core Foundation
                                          • 4.5 Carbon.CG -- Core Graphics
                                          • 4.6 Carbon.CarbonEvt -- Carbon Event Manager
                                          • 4.7 Carbon.Cm -- Component Manager
                                          • 4.8 Carbon.Ctl -- Control Manager
                                          • 4.9 Carbon.Dlg -- Dialog Manager
                                          • 4.10 Carbon.Evt -- Event Manager
                                          • 4.11 Carbon.Fm -- Font Manager
                                          • 4.12 Carbon.Folder -- Folder Manager
                                          • 4.13 Carbon.Help -- Help Manager
                                          • 4.14 Carbon.List -- List Manager
                                          • 4.15 Carbon.Menu -- Menu Manager
                                          • 4.16 Carbon.Mlte -- MultiLingual Text Editor
                                          • 4.17 Carbon.Qd -- QuickDraw
                                          • 4.18 Carbon.Qdoffs -- QuickDraw Offscreen
                                          • 4.19 Carbon.Qt -- QuickTime
                                          • 4.20 Carbon.Res -- Resource Manager and Handles
                                          • 4.21 Carbon.Scrap -- Scrap Manager
                                          • 4.22 Carbon.Snd -- Sound Manager
                                          • 4.23 Carbon.TE -- TextEdit
                                          • 4.24 Carbon.Win -- Window Manager
                                          • 4.25 ColorPicker -- Color selection dialog
                                        • 5. Undocumented Modules
                                          • 5.1 applesingle -- AppleSingle decoder
                                          • 5.2 buildtools -- Helper module for BuildApplet and Friends
                                          • 5.3 py_resource -- Resources from Python code
                                          • 5.4 cfmfile -- Code Fragment Resource module
                                          • 5.5 icopen -- Internet Config replacement for open()
                                          • 5.6 macerrors -- Mac OS Errors
                                          • 5.7 macresource -- Locate script resources
                                          • 5.8 Nav -- NavServices calls
                                          • 5.9 mkcwproject -- Create CodeWarrior projects
                                          • 5.10 nsremote -- Wrapper around Netscape OSA modules
                                          • 5.11 PixMapWrapper -- Wrapper for PixMap objects
                                          • 5.12 preferences -- Application preferences manager
                                          • 5.13 pythonprefs -- Preferences manager for Python
                                          • 5.14 quietconsole -- Non-visible standard output
                                          • 5.15 videoreader -- Read QuickTime movies
                                          • 5.16 W -- Widgets built on FrameWork
                                          • 5.17 waste -- non-Apple TextEdit replacement
                                        • A. History and License
                                          • A.1 History of the software
                                          • A.2 Terms and conditions for accessing or otherwise using Python
                                          • A.3 Licenses and Acknowledgements for Incorporated Software
                                            • A.3.1 Mersenne Twister
                                            • A.3.2 Sockets
                                            • A.3.3 Floating point exception control
                                            • A.3.4 MD5 message digest algorithm
                                            • A.3.5 Asynchronous socket services
                                            • A.3.6 Cookie management
                                            • A.3.7 Profiling
                                            • A.3.8 Execution tracing
                                            • A.3.9 UUencode and UUdecode functions
                                            • A.3.10 XML Remote Procedure Calls
                                          • Module Index
                                          • Index
                                          • About this document ...
                                        • Extending and Embedding
                                          • Front Matter
                                          • 1. Extending Python with C or C++
                                            • 1.1 A Simple Example
                                            • 1.2 Intermezzo: Errors and Exceptions
                                            • 1.3 Back to the Example
                                            • 1.4 The Module's Method Table and Initialization Function
                                            • 1.5 Compilation and Linkage
                                            • 1.6 Calling Python Functions from C
                                            • 1.7 Extracting Parameters in Extension Functions
                                            • 1.8 Keyword Parameters for Extension Functions
                                            • 1.9 Building Arbitrary Values
                                            • 1.10 Reference Counts
                                              • 1.10.1 Reference Counting in Python
                                              • 1.10.2 Ownership Rules
                                              • 1.10.3 Thin Ice
                                              • 1.10.4 NULL Pointers
                                            • 1.11 Writing Extensions in C++
                                            • 1.12 Providing a C API for an Extension Module
                                          • 2. Defining New Types
                                            • 2.1 The Basics
                                              • 2.1.1 Adding data and methods to the Basic example
                                              • 2.1.2 Providing finer control over data attributes
                                              • 2.1.3 Supporting cyclic garbage collection
                                            • 2.2 Type Methods
                                              • 2.2.1 Finalization and De-allocation
                                              • 2.2.2 Object Presentation
                                              • 2.2.3 Attribute Management
                                              • 2.2.4 Object Comparison
                                              • 2.2.5 Abstract Protocol Support
                                              • 2.2.6 More Suggestions
                                            • 3. Building C and C++ Extensions with distutils
                                              • 3.1 Distributing your extension modules
                                            • 4. Building C and C++ Extensions on Windows
                                              • 4.1 A Cookbook Approach
                                              • 4.2 Differences Between Unix and Windows
                                              • 4.3 Using DLLs in Practice
                                            • 5. Embedding Python in Another Application
                                              • 5.1 Very High Level Embedding
                                              • 5.2 Beyond Very High Level Embedding: An overview
                                              • 5.3 Pure Embedding
                                              • 5.4 Extending Embedded Python
                                              • 5.5 Embedding Python in C++
                                              • 5.6 Linking Requirements
                                            • A. Reporting Bugs
                                            • B. History and License
                                              • B.1 History of the software
                                              • B.2 Terms and conditions for accessing or otherwise using Python
                                              • B.3 Licenses and Acknowledgements for Incorporated Software
                                                • B.3.1 Mersenne Twister
                                                • B.3.2 Sockets
                                                • B.3.3 Floating point exception control
                                                • B.3.4 MD5 message digest algorithm
                                                • B.3.5 Asynchronous socket services
                                                • B.3.6 Cookie management
                                                • B.3.7 Profiling
                                                • B.3.8 Execution tracing
                                                • B.3.9 UUencode and UUdecode functions
                                                • B.3.10 XML Remote Procedure Calls
                                              • About this document ...
                                            • Python/C API
                                              • Front Matter
                                              • 1. Introduction
                                                • 1.1 Include Files
                                                • 1.2 Objects, Types and Reference Counts
                                                  • 1.2.1 Reference Counts
                                                  • 1.2.2 Types
                                                • 1.3 Exceptions
                                                • 1.4 Embedding Python
                                              • 2. The Very High Level Layer
                                              • 3. Reference Counting
                                              • 4. Exception Handling
                                                • 4.1 Standard Exceptions
                                                • 4.2 Deprecation of String Exceptions
                                              • 5. Utilities
                                                • 5.1 Operating System Utilities
                                                • 5.2 Process Control
                                                • 5.3 Importing Modules
                                                • 5.4 Data marshalling support
                                                • 5.5 Parsing arguments and building values
                                              • 6. Abstract Objects Layer
                                                • 6.1 Object Protocol
                                                • 6.2 Number Protocol
                                                • 6.3 Sequence Protocol
                                                • 6.4 Mapping Protocol
                                                • 6.5 Iterator Protocol
                                                • 6.6 Buffer Protocol
                                              • 7. Concrete Objects Layer
                                                • 7.1 Fundamental Objects
                                                  • 7.1.1 Type Objects
                                                  • 7.1.2 The None Object
                                                • 7.2 Numeric Objects
                                                  • 7.2.1 Plain Integer Objects
                                                  • 7.2.2 Boolean Objects
                                                  • 7.2.3 Long Integer Objects
                                                  • 7.2.4 Floating Point Objects
                                                  • 7.2.5 Complex Number Objects
                                                • 7.3 Sequence Objects
                                                  • 7.3.1 String Objects
                                                  • 7.3.2 Unicode Objects
                                                  • 7.3.3 Buffer Objects
                                                  • 7.3.4 Tuple Objects
                                                  • 7.3.5 List Objects
                                                • 7.4 Mapping Objects
                                                  • 7.4.1 Dictionary Objects
                                                • 7.5 Other Objects
                                                  • 7.5.1 File Objects
                                                  • 7.5.2 Instance Objects
                                                  • 7.5.3 Method Objects
                                                  • 7.5.4 Module Objects
                                                  • 7.5.5 Iterator Objects
                                                  • 7.5.6 Descriptor Objects
                                                  • 7.5.7 Slice Objects
                                                  • 7.5.8 Weak Reference Objects
                                                  • 7.5.9 CObjects
                                                  • 7.5.10 Cell Objects
                                                  • 7.5.11 Generator Objects
                                                  • 7.5.12 DateTime Objects
                                                • 8. Initialization, Finalization, and Threads
                                                  • 8.1 Thread State and the Global Interpreter Lock
                                                  • 8.2 Profiling and Tracing
                                                  • 8.3 Advanced Debugger Support
                                                • 9. Memory Management
                                                  • 9.1 Overview
                                                  • 9.2 Memory Interface
                                                  • 9.3 Examples
                                                • 10. Object Implementation Support
                                                  • 10.1 Allocating Objects on the Heap
                                                  • 10.2 Common Object Structures
                                                  • 10.3 Type Objects
                                                  • 10.4 Mapping Object Structures
                                                  • 10.5 Number Object Structures
                                                  • 10.6 Sequence Object Structures
                                                  • 10.7 Buffer Object Structures
                                                  • 10.8 Supporting the Iterator Protocol
                                                  • 10.9 Supporting Cyclic Garbage Collection
                                                • A. Reporting Bugs
                                                • B. History and License
                                                  • B.1 History of the software
                                                  • B.2 Terms and conditions for accessing or otherwise using Python
                                                  • B.3 Licenses and Acknowledgements for Incorporated Software
                                                    • B.3.1 Mersenne Twister
                                                    • B.3.2 Sockets
                                                    • B.3.3 Floating point exception control
                                                    • B.3.4 MD5 message digest algorithm
                                                    • B.3.5 Asynchronous socket services
                                                    • B.3.6 Cookie management
                                                    • B.3.7 Profiling
                                                    • B.3.8 Execution tracing
                                                    • B.3.9 UUencode and UUdecode functions
                                                    • B.3.10 XML Remote Procedure Calls
                                                  • Index
                                                  • About this document ...
                                                • Documenting Python
                                                  • 1 Introduction
                                                  • 2 Directory Structure
                                                  • 3 Style Guide
                                                  • 4 LaTeX Primer
                                                    • 4.1 Syntax
                                                    • 4.2 Hierarchical Structure
                                                    • 4.3 Common Environments
                                                  • 5 Document Classes
                                                  • 6 Special Markup Constructs
                                                    • 6.1 Markup for the Preamble
                                                    • 6.2 Meta-information Markup
                                                    • 6.3 Information Units
                                                    • 6.4 Showing Code Examples
                                                    • 6.5 Inline Markup
                                                    • 6.6 Miscellaneous Text Markup
                                                    • 6.7 Module-specific Markup
                                                    • 6.8 Library-level Markup
                                                    • 6.9 Table Markup
                                                    • 6.10 Reference List Markup
                                                    • 6.11 Index-generating Markup
                                                    • 6.12 Grammar Production Displays
                                                    • 6.13 Graphical Interface Components
                                                  • 7 Processing Tools
                                                    • 7.1 External Tools
                                                    • 7.2 Internal Tools
                                                    • 7.3 Working on Cygwin
                                                  • 8 Including Graphics
                                                  • 9 Future Directions
                                                    • 9.1 Structured Documentation
                                                    • 9.2 Discussion Forums
                                                  • About this document ...
                                                • Installing Python Modules
                                                  • 1 Introduction
                                                    • 1.1 Best case: trivial installation
                                                    • 1.2 The new standard: Distutils
                                                  • 2 Standard Build and Install
                                                    • 2.1 Platform variations
                                                    • 2.2 Splitting the job up
                                                    • 2.3 How building works
                                                    • 2.4 How installation works
                                                  • 3 Alternate Installation
                                                    • 3.1 Alternate installation: the home scheme
                                                    • 3.2 Alternate installation: Unix (the prefix scheme)
                                                    • 3.3 Alternate installation: Windows (the prefix scheme)
                                                  • 4 Custom Installation
                                                    • 4.1 Modifying Python's Search Path
                                                  • 5 Distutils Configuration Files
                                                    • 5.1 Location and names of config files
                                                    • 5.2 Syntax of config files
                                                  • 6 Building Extensions: Tips and Tricks
                                                    • 6.1 Tweaking compiler/linker flags
                                                    • 6.2 Using non-Microsoft compilers on Windows
                                                      • 6.2.1 Borland C++
                                                      • 6.2.2 GNU C / Cygwin / MinGW
                                                    • About this document ...
                                                  • Distributing Python Modules
                                                    • 1. An Introduction to Distutils
                                                      • 1.1 Concepts & Terminology
                                                      • 1.2 A Simple Example
                                                      • 1.3 General Python terminology
                                                      • 1.4 Distutils-specific terminology
                                                    • 2. Writing the Setup Script
                                                      • 2.1 Listing whole packages
                                                      • 2.2 Listing individual modules
                                                      • 2.3 Describing extension modules
                                                        • 2.3.1 Extension names and packages
                                                        • 2.3.2 Extension source files
                                                        • 2.3.3 Preprocessor options
                                                        • 2.3.4 Library options
                                                        • 2.3.5 Other options
                                                      • 2.4 Installing Scripts
                                                      • 2.5 Installing Package Data
                                                      • 2.6 Installing Additional Files
                                                      • 2.7 Additional meta-data
                                                      • 2.8 Debugging the setup script
                                                    • 3. Writing the Setup Configuration File
                                                    • 4. Creating a Source Distribution
                                                      • 4.1 Specifying the files to distribute
                                                      • 4.2 Manifest-related options
                                                    • 5. Creating Built Distributions
                                                      • 5.1 Creating dumb built distributions
                                                      • 5.2 Creating RPM packages
                                                      • 5.3 Creating Windows Installers
                                                        • 5.3.1 The Postinstallation script
                                                      • 6. Registering with the Package Index
                                                      • 7. Examples
                                                        • 7.1 Pure Python distribution (by module)
                                                        • 7.2 Pure Python distribution (by package)
                                                        • 7.3 Single extension module
                                                      • 8. Extending Distutils
                                                        • 8.1 Integrating new commands
                                                      • 9. Command Reference
                                                        • 9.1 Installing modules: the install command family
                                                          • 9.1.1 install_data
                                                          • 9.1.2 install_scripts
                                                        • 9.2 Creating a source distribution: the sdist command
                                                      • 10. API Reference
                                                        • 10.1 distutils.core -- Core Distutils functionality
                                                        • 10.2 distutils.ccompiler -- CCompiler base class
                                                        • 10.3 distutils.unixccompiler -- Unix C Compiler
                                                        • 10.4 distutils.msvccompiler -- Microsoft Compiler
                                                        • 10.5 distutils.bcppcompiler -- Borland Compiler
                                                        • 10.6 distutils.cygwincompiler -- Cygwin Compiler
                                                        • 10.7 distutils.emxccompiler -- OS/2 EMX Compiler
                                                        • 10.8 distutils.mwerkscompiler -- Metrowerks CodeWarrior support
                                                        • 10.9 distutils.archive_util -- Archiving utilities
                                                        • 10.10 distutils.dep_util -- Dependency checking
                                                        • 10.11 distutils.dir_util -- Directory tree operations
                                                        • 10.12 distutils.file_util -- Single file operations
                                                        • 10.13 distutils.util -- Miscellaneous other utility functions
                                                        • 10.14 distutils.dist -- The Distribution class
                                                        • 10.15 distutils.extension -- The Extension class
                                                        • 10.16 distutils.debug -- Distutils debug mode
                                                        • 10.17 distutils.errors -- Distutils exceptions
                                                        • 10.18 distutils.fancy_getopt -- Wrapper around the standard getopt module
                                                        • 10.19 distutils.filelist -- The FileList class
                                                        • 10.20 distutils.log -- Simple PEP 282-style logging
                                                        • 10.21 distutils.spawn -- Spawn a sub-process
                                                        • 10.22 distutils.sysconfig -- System configuration information
                                                        • 10.23 distutils.text_file -- The TextFile class
                                                        • 10.24 distutils.version -- Version number classes
                                                        • 10.25 distutils.cmd -- Abstract base class for Distutils commands
                                                        • 10.26 distutils.command -- Individual Distutils commands
                                                        • 10.27 distutils.command.bdist -- Build a binary installer
                                                        • 10.28 distutils.command.bdist_packager -- Abstract base class for packagers
                                                        • 10.29 distutils.command.bdist_dumb -- Build a ``dumb'' installer
                                                        • 10.30 distutils.command.bdist_rpm -- Build a binary distribution as a Redhat RPM and SRPM
                                                        • 10.31 distutils.command.bdist_wininst -- Build a Windows installer
                                                        • 10.32 distutils.command.sdist -- Build a source distribution
                                                        • 10.33 distutils.command.build -- Build all files of a package
                                                        • 10.34 distutils.command.build_clib -- Build any C libraries in a package
                                                        • 10.35 distutils.command.build_ext -- Build any extensions in a package
                                                        • 10.36 distutils.command.build_py -- Build the .py/.pyc files of a package
                                                        • 10.37 distutils.command.build_scripts -- Build the scripts of a package
                                                        • 10.38 distutils.command.clean -- Clean a package build area
                                                        • 10.39 distutils.command.config -- Perform package configuration
                                                        • 10.40 distutils.command.install -- Install a package
                                                        • 10.41 distutils.command.install_data -- Install data files from a package
                                                        • 10.42 distutils.command.install_headers -- Install C/C++ header files from a package
                                                        • 10.43 distutils.command.install_lib -- Install library files from a package
                                                        • 10.44 distutils.command.install_scripts -- Install script files from a package
                                                        • 10.45 distutils.command.register -- Register a module with the Python Package Index
                                                        • 10.46 Creating a new Distutils command
                                                      • Module Index
                                                      • Index
                                                      • About this document ...