Interfaces (a la PEP 245 and Zope)

Terry Hancock hancock at anansispaceworks.com
Fri Aug 1 18:19:21 EDT 2003


Brendan Hahn wrote:
> How about an Interface metaclass that replaces any class methods with an
> appropriate exception-raiser.  It would save a little typing, e.g.
> 
>    class IEditor():
>       __metaclass__ = Interface
>       def GetSelection(self, start, end): pass
>       def SetSelection(self, start, end, data): pass
> 
> ...and so on.

Well Zope's (or should I say Jim Fulton's?) Interface module
defines an object with a number of useful documentation and
validation behaviors.

-- 
Terry Hancock
Anansi Spaceworks http://www.AnansiSpaceworks.com/





More information about the Python-list mailing list