Class Interface
- Known Subclasses:
-
IConnector
,
ICollection
,
IService
,
IProtocolFactory
,
IConfigurator
,
IResource
,
IDomain
,
IConsumer
,
IClient
,
IGroup
,
IConversation
,
IAccount
,
IPerson
,
IChatUI
,
IGroupConversation
,
IReactorMulticast
,
IUDPTransport
,
IReactorPluggableResolver
,
IFileDescriptor
,
IReactorSSL
,
IProducer
,
IUDPConnectedTransport
,
ITransport
,
IDelayedCall
,
IResolverSimple
,
IReactorUNIX
,
IReactorCore
,
IServiceCollection
,
IReactorTCP
,
IReactorTime
,
IListeningPort
,
IReactorFDSet
,
IReactorUDP
,
IMulticastTransport
,
IReactorProcess
,
IReactorThreads
,
IMessage
,
ICommand
,
ICommandLog
,
IHeaderSaver
,
IModel
,
IWovenLivePage
,
IController
,
IView
,
INodeMutator
,
IWordsClient
,
IWordsPolicy
,
IAdder
,
IAdept
,
IMultiply
,
ITest4
,
ITest3
,
ITest2
,
ITest
,
IX
,
IFoo
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