You are previewing Python Pocket Reference, Second Edition.
O'Reilly logo
Python Pocket Reference, Second Edition

Book Description

Python is optimized for quality, productivity, portability, and integration. Hundreds of thousands of Python developers around the world rely on Python for Internet scripting, systems programming, user interfaces, and product customization. Python is available on all major computing platforms, including commercial versions of Unix, Linux, Windows, and Mac OS. It's portable, powerful, and remarkably easy to use. It's also an interpreted language, designed for rapid application development and deployment. Python Pocket Reference, 2nd Edition is a companion volume to two O'Reilly Animal Guides, Programming Python, 2nd Edition and Learning Python. It summarizes Python statements and types, built-in functions, commonly used library modules, and other prominent Python language features. This pocket reference covers the latest Python release 2.2, and provides quick access to just what you're looking for. It is a short, concise reference for the most commonly used libraries and tools. The new edition also includes new summary material for Python's GUI, Internet, and database programming tools. The author, Mark Lutz, is a Python luminary-who has been on the Python scene since its inception.

Table of Contents

  1. Python Pocket Reference, 2nd Edition
    1. 1. Python Pocket Reference
      1. Introduction
      2. Conventions
      3. Command-Line Options
        1. Python Options
        2. Program Specification
      4. Environment Variables
      5. Built-in Types and Operators
        1. Operators and Precedence
        2. Operations by Category
        3. Sequence Operation Notes
          1. Indexing: S[i]
          2. Slicing: S[i:j]
          3. Other
      6. Specific Built-in Types
        1. Numbers
          1. Constants
          2. Operations
        2. Strings
          1. Constants
          2. Operations
          3. String methods
          4. Unicode strings
            1. Constants
            2. Operations
        3. Lists
          1. Constants
          2. Operations
          3. List comprehension expressions
        4. Dictionaries
          1. Constants
          2. Operations
        5. Tuples
          1. Constants
          2. Operations
        6. Files
          1. Input files
          2. Output files
          3. Any files
          4. Attributes
          5. Notes
        7. Type Conversions
      7. Statements and Syntax
        1. Syntax Rules
        2. Name Rules
          1. Name format
          2. Name conventions
      8. Specific Statements
        1. Assignment
        2. Expressions
        3. The print Statement
        4. The if Statement
        5. The while Statement
        6. The for Statement
        7. The pass Statement
        8. The break Statement
        9. The continue Statement
        10. The del Statement
        11. The exec Statement
        12. The def Statement
        13. The return Statement
        14. The yield Statement
        15. The global Statement
        16. The import Statement
        17. The from Statement
        18. The class Statement
        19. The try Statement
        20. The raise Statement
        21. The assert Statement
      9. Namespace and Scope Rules
        1. Qualified Names: Object Namespaces
        2. Unqualified Names: Lexical Scopes
          1. Statically nested scopes
      10. Object-Oriented Programming
        1. Classes and Instances
          1. Class objects provide default behavior
          2. Instance objects are generated from classes
          3. Inheritance rules
        2. Pseudo-Private Attributes
          1. Module privates
          2. Class privates
      11. Operator Overloading Methods
        1. For All Types
        2. For Collections (Sequences, Mappings)
        3. For Numbers (Binary Operators)
          1. Basic binary methods
          2. Right-side binary methods
          3. Augmented binary methods
        4. For Numbers (Other Operations)
      12. Built-in Functions
      13. Built-in Exceptions
        1. Base Classes (Categories)
        2. Specific Exceptions Raised
          1. Warning category exceptions
            1. Warnings framework
      14. Built-in Attributes
      15. Built-in Modules
      16. The sys Interpreter Module
      17. The string Module and Methods
        1. Module Functions Versus String Object Methods
        2. Constants
        3. Functions and Methods
          1. Conversions
          2. Searching
          3. Splitting and joining
          4. Formatting
      18. The os System Module
        1. Administrative Tools
        2. Portability Constants
        3. Shell Commands
        4. Environment Tools
        5. File Descriptor Tools
        6. File Pathname Tools
        7. Process Control
        8. The os.path Module
      19. The re Pattern-Matching Module
        1. Module Functions
        2. Regular Expression Objects
        3. Match Objects
        4. Pattern Syntax
          1. Example
      20. Object Persistence Modules
        1. anydbm and shelve Interfaces
          1. Notes
        2. pickle Interface
          1. Notes
      21. Tkinter GUI Module and Tools
        1. Tkinter Example
        2. Tkinter Core Widgets
        3. Common Dialog Calls
          1. Module tkMessageBox
          2. Module tkSimpleDialog
          3. Module tkColorChooser
          4. Module tkFileDialog
        4. Additional Tkinter Classes and Tools
        5. Tcl/Tk-to-Python/Tkinter Mappings
      22. Internet Modules and Tools
        1. Commonly Used Library Modules
      23. Other Built-in Modules
        1. The math Module
        2. The time Module
        3. Threading Modules
      24. Major Python/C API Tools
        1. General
        2. Reference Counts
        3. Data Translation
        4. Module Access
        5. Exceptions
        6. Running Strings of Code
        7. Running Callable Objects
        8. Running Files and Interactive Loops
        9. Object Access
      25. Python Portable SQL Database API
        1. API Usage Example
        2. Module Interface
        3. Connection Objects
        4. Cursor Objects
        5. Type Objects and Constructors
      26. Python Idioms and Hints
        1. Core Language Hints
        2. Environment Hints
        3. Usage Hints
        4. Assorted Hints