#
2. Defining New Types

As mentioned in the last chapter, Python allows the writer of an extension module to define new types that can be manipulated from Python code, much like strings and lists in core Python.

This is not hard; the code for all extension types follows a pattern, but there are some details that you need to understand before you can get started.

Subsections

- 2.1 The Basics
- 2.2 Type Methods
  - 2.2.1 Finalization and De-allocation
  - 2.2.2 Object Representation
  - 2.2.3 Attribute Management Functions
  - 2.2.4 Object Comparison
  - 2.2.5 Abstract Protocol Support
  - 2.2.6 More Suggestions