# Dive Into Python

Python for experienced programmers

Find:

## Appendix A. Further reading

Chapter 1. Getting To Know Python

- 1.3. Documenting functions

  - Python Style Guide discusses how to write a good `doc string`.
  - Python Tutorial discusses conventions for spacing in `doc string`s.

- 1.4. Everything is an object

  - Python Reference Manual explains exactly what it means to say that everything in Python is an object, because some people are pedantic and like to discuss this sort of thing at great length.
  - eff-bot summarizes Python objects.

- 1.5. Indenting code

  - Python Reference Manual discusses cross-platform indentation issues and shows various indentation errors.
  - Python Style Guide discusses good indentation style.

- 1.6. Testing modules

  - Python Reference Manual discusses the low-level details of importing modules.

- 1.7. Introducing dictionaries

  - How to Think Like a Computer Scientist teaches about dictionaries and shows how to use dictionaries to model sparse matrices.
  - Python Knowledge Base has lots of example code using dictionaries.
  - Python Cookbook discusses how to sort the values of a dictionary by key.
  - Python Library Reference summarizes all the dictionary methods.

- 1.8. Introducing lists

  - How to Think Like a Computer Scientist teaches about lists and makes an important point about passing lists as function arguments.
  - Python Tutorial shows how to use lists as stacks and queues.
  - Python Knowledge Base answers common questions about lists and has lots of example code using lists.
  - Python Library Reference summarizes all the list methods.

- 1.9. Introducing tuples

  - How to Think Like a Computer Scientist teaches about tuples and shows how to concatenate tuples.
  - Python Knowledge Base shows how to sort a tuple.
  - Python Tutorial shows how to define a tuple with one element.

- 1.10. Defining variables

  - Python Reference Manual shows examples of when you can skip the line continuation character and when you have to use it.

- 1.11. Assigning multiple values at once

  - How to Think Like a Computer Scientist shows how to use multi-variable assignment to swap the values of two variables.

- 1.12. Formatting strings

  - Python Library Reference summarizes all the string formatting format characters.
  - Effective AWK Programming discusses all the format characters and advanced string formatting techniques like specifying width, precision, and zero-padding.

- 1.13. Mapping lists

  - Python Tutorial discusses another way to map lists using the built-in `map` function.
  - Python Tutorial shows how to do nested list comprehensions.

- 1.14. Joining lists and splitting strings

  - Python Knowledge Base answers common questions about strings and has lots of example code using strings.
  - Python Library Reference summarizes all the string methods.
  - Python Library Reference documents the `string` module.
  - The Whole Python FAQ explains why `join` is a string method instead of a list method.

Chapter 2. The Power Of Introspection

- 2.2. Optional and named arguments

  - Python Tutorial discusses exactly when and how default arguments are evaluated, which matters when the default value is a list or an expression with side effects.

- 2.3. type, str, dir, and other built-in functions

  - Python Library Reference documents all the built-in functions and all the built-in exceptions.

- 2.5. Filtering lists

  - Python Tutorial discusses another way to filter lists using the built-in `filter` function.

- 2.6. The peculiar nature of and and or

  - Python Cookbook discusses alternatives to the `and-or` trick.

- 2.7. Using lambda functions

  - Python Knowledge Base discusses using `lambda` to call functions indirectly.
  - Python Tutorial shows how to access outside variables from inside a `lambda` function. (PEP 227 explains how this will change in future versions of Python.)
  - The Whole Python FAQ has examples of obfuscated one-liners using `lambda`.

Chapter 3. An Object-Oriented Framework

- 3.2. Importing modules using from module import

  - eff-bot has more to say on `import module` vs. `from module import`.
  - Python Tutorial discusses advanced import techniques, including `from module import *`.

- 3.3. Defining classes

  - Learning to Program has a gentler introduction to classes.
  - How to Think Like a Computer Scientist shows how to use classes to model compound datatypes.
  - Python Tutorial has an in-depth look at classes, namespaces, and inheritance.
  - Python Knowledge Base answers common questions about classes.

- 3.4. Instantiating classes

  - Python Library Reference summarizes built-in attributes like `__class__`.
  - Python Library Reference documents the `gc` module, which gives you low-level control over Python’s garbage collection.

- 3.5. UserDict: a wrapper class

  - Python Library Reference documents the `UserDict` module and the `copy` module.

- 3.7. Advanced special class methods

  - Python Reference Manual documents all the special class methods.

- 3.9. Private functions

  - Python Tutorial discusses the inner workings of private variables.

- 3.10. Handling exceptions

  - Python Tutorial discusses defining and raising your own exceptions, and handling multiple exceptions at once.
  - Python Library Reference summarizes all the built-in exceptions.
  - Python Library Reference documents the getpass module.
  - Python Library Reference documents the `traceback` module, which provides low-level access to exception attributes after an exception is raised.
  - Python Reference Manual discusses the inner workings of the `try...except` block.

- 3.11. File objects

  - Python Tutorial discusses reading and writing files, including how to read a file one line at a time into a list.
  - eff-bot discusses efficiency and performance of various ways of reading a file.
  - Python Knowledge Base answers common questions about files.
  - Python Library Reference summarizes all the file object methods.

- 3.13. More on modules

  - Python Tutorial discusses exactly when and how default arguments are evaluated.
  - Python Library Reference documents the `sys` module.

- 3.14. The os module

  - Python Knowledge Base answers questions about the `os` module.
  - Python Library Reference documents the `os` module and the `os.path` module.

Chapter 4. HTML Processing

- 4.4. Introducing BaseHTMLProcessor.py

  - W3C discusses character and entity references.
  - Python Library Reference confirms your suspicions that the `htmlentitydefs` module is exactly what it sounds like.

- 4.9. Regular expressions 101

  - Regular Expression HOWTO teaches about regular expressions and how to use them in Python.
  - Python Library Reference summarizes the `re` module.

- 4.10. Putting it all together

  - You thought I was kidding about the server-side scripting idea. So did I, until I found this web-based dialectizer. I have no idea if it’s implemented in Python, but my company’s home page is funny as hell in Pig Latin. Unfortunately, source code does not appear to be available.

Chapter 5. XML Processing

- 5.4. Unicode

  - Unicode.org is the home page of the unicode standard, including a brief technical introduction.
  - Unicode Tutorial has some more examples of how to use Python’s unicode functions, including how to force Python to coerce unicode into ASCII even when it doesn’t really want to.
  - Unicode Proposal is the original technical specification for Python’s unicode functionality. For advanced unicode hackers only.

Chapter 6. Unit Testing

- 6.1. Diving in

  - This site has more on Roman numerals, including a fascinating history of how Romans and other civilizations really used them (short answer: haphazardly and inconsistently).

- 6.2. Introducing romantest.py

  - The PyUnit home page has an in-depth discussion of using the `unittest` framework, including advanced features not covered in this chapter.
  - The PyUnit FAQ explains why test cases are stored separately from the code they test.
  - Python Library Reference summarizes the `unittest` module.
  - ExtremeProgramming.org discusses why you should write unit tests.
  - The Portland Pattern Repository has an ongoing discussion of unit tests, including a standard definition, why you should code unit tests first, and several in-depth case studies.

- 6.15. Summary

  - XProgramming.com has links to download unit testing frameworks for many different languages.

Chapter 7. Data-Centric Programming