You are here: Home Dive Into Python 3

Table of contents

  1. Installing Python
    1. Python on Windows
    2. Python on Mac OS X
    3. Python on Ubuntu Linux
    4. Python from source
    5. The interactive shell
  2. Your first Python program
    1. Diving in
    2. Declaring functions
    3. Writing readable code
      1. Docstrings
      2. Function annotations
      3. Style conventions
    4. Everything is an object
      1. The import search path
      2. What’s an object?
    5. Indenting code
    6. Running scripts
    7. Further reading
  3. Native Python datatypes
    1. Diving in
    2. Booleans
    3. Numbers
      1. Coercing integers to floats and vice-versa
      2. Common numerical operations
      3. Fractions
      4. Trigonometry
      5. Numbers in a boolean context
    4. Lists
      1. Creating a list
      2. Slicing a list
      3. Adding items to a list
      4. Searching for values in a list
      5. Lists in a boolean context
    5. Dictionaries
      1. Creating a dictionary
      2. Modifying a dictionary
      3. Mixed-value dictionaries
      4. Dictionaries in a boolean context
    6. None
      1. None in a boolean context
    7. Further reading
  4. Strings
    1. Diving in
    2. Unicode
      1. How strings are stored in memory
      2. Converting between different character encodings
      3. Specifying character encoding in .py files
    3. Strings in Python 3
    4. Common string operations
    5. Formatting strings
    6. The string module
    7. Strings vs. bytes
    8. Further reading
  5. Regular expressions
    1. Diving in
    2. Case study: street addresses
    3. Case study: Roman numerals
      1. Checking for thousands
      2. Checking for hundreds
    4. Using the {n,m} Syntax
      1. Checking for tens and ones
    5. Verbose regular expressions
    6. Case study: parsing phone numbers
    7. Summary
  6. Generators
    1. Diving in
    2. I know, let’s use regular expressions!
    3. A list of functions
    4. A list of patterns
    5. A file of patterns
    6. Generators
      1. A Fibonacci generator
      2. A plural rule generator
  7. Iterators
    1. Iterators
      1. A Fibonacci iterator
      2. A plural rule iterator
    2. Further reading
  8. Advanced Iterators
    1. Diving In
    2. Finding all occurrences of a pattern
    3. Finding the unique items in a sequence
    4. Making assertions
    5. Generator expressions
    6. Calculating Permutations… The Lazy Way!
    7. Other Fun Stuff in the itertools Module
    8. A New Kind Of String Manipulation
    9. Evaluating Arbitrary Strings As Python Expressions
    10. Putting It All Together
    11. Further Reading
    12. Objects and object-orientation
      1. ...major changes afoot...
      2. Unit testing
        1. (Not) diving in
        2. A single question
        3. “Halt and catch fire”
        4. More halting, more fire
        5. ...
      3. Test-first programming
        1. ...
      4. Refactoring your code
        1. Handling bugs
        2. Handling changing requirements
        3. The art of refactoring
        4. Postscript
        5. Summary
      5. Advanced Classes
        1. Diving in
      6. Files
        1. File objects
        2. Reading files
        3. Close your files... or don't
        4. Handling errors (exceptions)
        5. Writing to files
      7. HTML processing
        1. Diving in
        2. html5lib
          1. Installing html5lib
          2. Using html5lib
        3. Extracting data from HTML documents
        4. Building HTML documents
        5. Putting it all together
        6. Summary
      8. XML Processing
        1. ...major changes afoot...
        2. lxml 2.2 officially supports Python 3
      9. HTTP web services
        1. Diving in
        2. How not to fetch data over HTTP
        3. Features of HTTP
          1. User-Agent
          2. Redirects
          3. Last-Modified/If-Modified-Since
          4. ETag-If-None-Match
          5. Compression
        4. Differences from Python 2
        5. httplib2 (note: needs port)
          1. Installing httplib2
          2. Why httplib2 is better than http.client
        6. Debugging HTTP web services
        7. Setting the User-Agent
        8. Handling Last-Modified and ETag
        9. Handling redirects
        10. Handling compressed data
        11. Putting it all together
        12. Summary
      10. Performance tuning
        1. Diving in
        2. Using the timeit module
        3. Optimizing regular expressions
        4. Optimizing dictionary lookups
        5. Optimizing list operations
        6. Optimizing string manipulation
        7. Summary
      11. Packaging Python libraries
        1. A brief history of packaging (and why it's harder than you think)
        2. setuptools
        3. distutils
        4. Eggs
        5. pip
        6. Platform-specific packaging
          1. Packaging by Linux distributions
          2. Py2exe
      12. Creating graphics with the Python Imaging Library
        1. ...will likely get ported in time...
      13. Where to go from here (tentative because most of these have not been ported to Python 3 yet)
        1. WSGI
        2. Django
        3. Pylons
        4. TurboGears
        5. AppEngine
        6. IronPython
        7. Jython
        8. PyPy
        9. Stackless Python
      14. Case study: porting chardet to Python 3
        1. Introducing chardet: a mini-FAQ
          1. What is character encoding auto-detection?
          2. Isn’t that impossible?
          3. Who wrote this detection algorithm?
          4. Yippie! Screw the standards, I’ll just auto-detect everything!
          5. Why bother with auto-detection if it’s slow, inaccurate, and non-standard?
        2. Diving in
          1. UTF-n with a BOM
          2. Escaped encodings
          3. Multi-byte encodings
          4. Single-byte encodings
          5. windows-1252
        3. Running 2to3
        4. Fixing what 2to3 can’t
          1. False is invalid syntax
          2. No module named constants
          3. Name 'file' is not defined
          4. Can’t use a string pattern on a bytes-like object
          5. Can’t convert 'bytes' object to str implicitly

      Orphans (not sure where these belong yet):

      • Tuples
      • List comprehensions
      • Set comprehensions
      • Dictionary comprehensions
      • Views (several dictionary methods return them, they're dynamic, update when the dictionary changes, etc.)
      • Decorators
      • Importing modules
        1. ...mention why from module import * is only allowed at module level

    © 2001–9 Mark Pilgrim