Package zope :: Package interface :: Module interface :: Class SpecificationBasePy
[show private | hide private]
[frames | no frames]

Type SpecificationBasePy

object --+
         |
        SpecificationBasePy

Known Subclasses:
Specification

Method Summary
  implementedBy(self, cls)
Do instances of the given class implement the interface?
  isOrExtends(self, interface)
Is the interface the same as or extend the given interface
  providedBy(self, ob)
Is the interface implemented by an object
    Inherited from object
  __init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
Implements __implemented__ = <implementedBy zope.interface.interfac...
ClassProvides __providedBy__ = <zope.interface.declarations.ClassProvi...
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...

Method Details

implementedBy(self, cls)

Do instances of the given class implement the interface?

isOrExtends(self, interface)

Is the interface the same as or extend the given interface

Examples:
 >>> from zope.interface import Interface
 >>> from zope.interface.declarations import Declaration
 >>> class I1(Interface): pass
 ...
 >>> class I2(I1): pass
 ...
 >>> class I3(Interface): pass
 ...
 >>> class I4(I3): pass
 ...
 >>> spec = Declaration()
 >>> int(spec.extends(Interface))
 0
 >>> spec = Declaration(I2)
 >>> int(spec.extends(Interface))
 1
 >>> int(spec.extends(I1))
 1
 >>> int(spec.extends(I2))
 1
 >>> int(spec.extends(I3))
 0
 >>> int(spec.extends(I4))
 0

providedBy(self, ob)

Is the interface implemented by an object
>>> from zope.interface import *
>>> class I1(Interface):
...     pass
>>> class C(object):
...     implements(I1)
>>> c = C()
>>> class X(object):
...     pass
>>> x = X()
>>> I1.providedBy(x)
False

>>> I1.providedBy(C)
False

>>> I1.providedBy(c)
True

>>> directlyProvides(x, I1)
>>> I1.providedBy(x)
True

>>> directlyProvides(C, I1)
>>> I1.providedBy(C)
True

Class Variable Details

__implemented__

Type:
Implements
Value:
<implementedBy zope.interface.interface.SpecificationBasePy>           

__providedBy__

Type:
ClassProvides
Value:
<zope.interface.declarations.ClassProvides object at 0xb7e1fdec>       

__provides__

Type:
ClassProvides
Value:
<zope.interface.declarations.ClassProvides object at 0xb7e1fdec>       

Generated by Epydoc 2.1 on Fri Jun 24 12:01:24 2005 http://epydoc.sf.net