Interfaces != Multiple Inheritance [was Re: python development practices?]
Wade Leftwich
wade at lightlink.com
Wed Oct 31 08:54:30 EST 2001
Zope 2.4 includes an Interface module that can be used outside Zope.
It provides lots of nice introspection methods.
quoting the ZopeDevGuide:
from Interface import Base
class Hello(Base):
""" The Hello interface provides greetings. """
def hello(self, name):
""" Say hello to the name """
class HelloComponent:
__implements__ = Hello
def hello(self, name):
return "hello %s!" % name
#############
Hello looks like a class, but it's not:
>>> Hello
<Interface Hello at 109189c>
>>> type(Hello)
<type 'instance'>
More information about the Python-list
mailing list