Class Interface
- Known Subclasses:
-
IProtocolFactory,
ICollection,
IService,
IConnector,
IConfigurator,
IResource,
IDomain,
IConsumer,
IPerson,
IAccount,
IConversation,
IGroup,
IGroupConversation,
IChatUI,
IClient,
IReactorProcess,
IResolverSimple,
ITransport,
IReactorPluggableResolver,
IFileDescriptor,
IReactorTCP,
IReactorArbitrary,
IProducer,
IMulticastTransport,
IListeningPort,
IReactorTime,
IUDPTransport,
IReactorFDSet,
IReactorCore,
IReactorUNIX,
IReactorThreads,
IDelayedCall,
IServiceCollection,
IProtocol,
IUDPConnectedTransport,
IReactorSSL,
IReactorUDP,
IReactorMulticast,
IMessage,
IManholeClient,
ICommand,
ICommandLog,
IHeaderSaver,
IBucketFilter,
IClientAuthentication,
IMailbox,
IServerAuthentication,
IAccount,
IMailboxListener,
IRemoteReporter,
IModel,
IView,
IWovenLivePage,
IController,
INodeMutator,
IWordsClient,
IWordsPolicy
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