Copyright © 2005 Shalabh Chaturvedi
About This Book
Explains the mechanics of attribute access, how functions become methods, descriptors, properties, MRO and the like for new-style Python objects. New-style implies Python version 2.2 and up.
This book is part of a series:
Python Attributes and Methods [you are here]
This revision: 1.20
Links: Latest version
| Other formats
| Discuss
Author: shalabh@cafepy.com
Table of Contents
List of Figures
List of Examples
- 1.1. Simple attribute access
- 1.2. A function is more
- 1.3. A simple descriptor
- 1.4. Using a descriptor
- 1.5. Non-data descriptors
- 1.6. Hiding a method
- 1.7. Built-in descriptors
- 1.8. More on properties
- 2.1. Usual base call technique
- 2.2. Base call technique fails
- 2.3. Making a "Who's Next" list
- 2.4. Call next method technique
- 2.5. One super technique
- 2.6. Using super with a class method
- 2.7. Another super technique
- 3.1. Emulation using type only
- 3.2. Forwarding emulator method to instance
- 3.3. Subtyping <type 'list'>
- 3.4. Using
__slots__for optimization - 3.5. Customizing creation of subtypes