Table of Contents

Class: Interface | Twisted-0.19.0/twisted/python/components.py
--- | ---
### Base class for interfaces. Interfaces define and document an interface for a class. An interface class's name must begin with I, and all its methods should have no implementation code. Objects that implement an interface should have an attribute __implements__, that should be either an Interface subclass or a tuple, or tuple of tuples, of such Interface classes. A class whose instances implement an interface should list the interfaces its instances implement in a class-level __implements__. For example:
            | class IAdder(Interface):
            |     'Objects implementing this interface can add objects.'
            |
            |     def add(self, a, b):
            |         'Add two objects together and return the result.'
            |
            | class Adder:
            |
            |     __implements__ = IAdder
            |
            |     def add(self, a, b):
            |         return a + b

Table of Contents

This document was automatically generated on Sun Jul 14 19:53:11 2002 by HappyDoc version 2.0