You are here: Home Dive Into Python 3

Table of contents

  1. What’s New In “Dive Into Python 3”
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. Iterators
    1. Diving In
    2. Defining Classes
    3. Instantiating Classes
    4. Instance Variables
    5. A Fibonacci iterator
    6. A Plural Rule Iterator
    7. Further Reading
  9. 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
  10. Unit testing
    1. (Not) diving in
    2. A single question
    3. “Halt and catch fire”
    4. More halting, more fire
    5. ...
  11. Test-first programming
    1. ...
  12. Refactoring your code
    1. Diving in
    2. Handling changing requirements
    3. Refactoring
    4. Summary
  13. Advanced Classes
    1. Diving in
  14. Files
    1. File objects
    2. Reading files
    3. Close your files... or don't
    4. Handling errors (exceptions)
    5. Writing to files
  15. XML
    1. Diving In
    2. A 5-Minute Crash Course in XML
    3. The Structure Of An Atom Feed
    4. Parsing XML
      1. Elements Are Lists
      2. Attributes Are Dictonaries
    5. Searching For Nodes Within An XML Document
    6. Going Further With lxml
      1. Customizing Your XML Parser
      2. Incremental Parsing
    7. Generating XML
    8. Further Reading
  16. HTML
    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
  17. HTTP
    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
  18. 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
  19. 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
  20. Creating graphics with the Python Imaging Library
    1. ...will likely get ported in time...
  21. 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
  22. 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):

© 2001–9 Mark Pilgrim