Trees | Index | Help |
---|
Package twisted :: Package python :: Module components :: Class Interface |
|
object
--+
|
Interface
ICredentials
,
ICredentialsChecker
,
IHeaven
,
IMedium
,
IPerspective
,
IRealm
,
IStateListener
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 + bYou 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.
Method Summary | |
---|---|
adaptWith(self,
using,
to,
registry)
(Class method) | |
Inherited from object | |
x.__init__(...) initializes x; see x.__class__.__doc__ for signature | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Class Variable Summary | |
---|---|
type |
__metaclass__ = twisted.python.components.MetaInterface |
Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Wed Feb 16 07:22:59 2005 | http://epydoc.sf.net |