|
Module __main__ ::
Class NonMetaInterface
|
|
Class NonMetaInterface
- Known Subclasses:
-
IConnector,
ICollection,
IService,
IProtocolFactory,
IConfigurator,
IResource,
IDomain,
IConsumer,
ICredentialsChecker,
ICredentials,
IRealm,
IPerspective,
IClient,
IGroup,
IConversation,
IAccount,
IPerson,
IChatUI,
IGroupConversation,
IDelayedCall,
IReactorMulticast,
IUDPTransport,
IReactorPluggableResolver,
IFileDescriptor,
IReactorSSL,
IReactorArbitrary,
IUDPConnectedTransport,
ITransport,
IResolverSimple,
IReactorUNIX,
IReactorCore,
IServiceCollection,
IProducer,
IReactorTCP,
IReactorTime,
IListeningPort,
IReactorFDSet,
IReactorUDP,
IProtocol,
IMulticastTransport,
IReactorProcess,
IReactorThreads,
IMessage,
IManholeClient,
ICommand,
ICommandLog,
IHeaderSaver,
IBucketFilter,
IMailboxListener,
IClientAuthentication,
IAccount,
IServerAuthentication,
IMailbox,
IRawPacketProtocol,
IMailbox,
IRawDatagramProtocol,
IUnjellyable,
IJellyable,
IRemoteReporter,
ITestRunner,
IModel,
IController,
IWovenLivePage,
IView,
INodeMutator,
IWordsClient,
IWordsPolicy,
ITypeMapper
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
You can call an Interface with a single argument; If the passed object
can be adapted to the Interface in some way, the adapter will be
returned.