How to dervie from an instance object?

bruno at modulix onurb at xiludom.gro
Thu Mar 9 13:51:50 CET 2006


reinsn wrote:
> Hi,
> 
> I am currently working with ZopeX3. Because python doesn't include
> concept of interfaces,

It does, but implicitly. The interface of an object is the set of
messages it understands.

> those were defined by the module zope.interface.
> 
> So interfaces were defined like:
> 
> class IMyInterface(zope.interface.Interface):
>    .....
> 
> I have looked into the module zope.interface and found, that
> zope.interface.Interface is an object instance and no class object! But
> how does this work? How can I derive from an object instance?

Python classes *are* objects - instances of their metaclass.

> I mean is something like this possible in Python?
> 
> class X: pass
> 
> x = X()
> 
> class Y (x):
>   .....

Not directly. Google for Python +metaclass.



-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list