Chapter 20. Descriptors, Decorators,and Metaclasses


    Introduction

    Recipe 20.1.  Getting Fresh Default Values at Each Function Call

    Recipe 20.2.  Coding Properties as Nested Functions

    Recipe 20.3.  Aliasing Attribute Values

    Recipe 20.4.  Caching Attribute Values

    Recipe 20.5.  Using One Method as Accessorfor Multiple Attributes

    Recipe 20.6.  Adding Functionality to a Class by Wrapping a Method

    Recipe 20.7.  Adding Functionality to a Class by Enriching All Methods

    Recipe 20.8.  Adding a Method to a Class Instance at Runtime

    Recipe 20.9.  Checking Whether Interfaces Are Implemented

    Recipe 20.10.  Using _ _new_ _ and _ _init_ _ Appropriately in Custom Metaclasses

    Recipe 20.11.  Allowing Chaining of Mutating List Methods

    Recipe 20.12.  Using Cooperative Super calls with Terser Syntax

    Recipe 20.13.  Initializing Instance Attributes Without Using _ _init_ _

    Recipe 20.14.  Automatic Initialization of Instance Attributes

    Recipe 20.15.  Upgrading Class Instances Automatically on reload

    Recipe 20.16.  Binding Constants at Compile Time

    Recipe 20.17.  Solving Metaclass Conflicts



Python Cookbook
Python Cookbook
ISBN: 0596007973
EAN: 2147483647
Year: 2004
Pages: 420

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net