[Python-3000] Abilities / Interfaces

Benji York benji at benjiyork.com
Wed Nov 22 14:36:18 CET 2006


Guido van Rossum wrote:
> 1. Naming and general ideas. Should we call these Abilities or
> Interfaces?

I'll try to make an argument for "Interface" over "Ability" using 
examples from Zope.

It seems to me that not all interfaces coincide with something the 
object can _do_.  Some speak to what can be done _to_ an object:

class IAttributeAnnotatable(IAnnotatable):
     """Marker indicating that annotations can be stored on an attribute.

     This is a marker interface giving permission for an `IAnnotations`
     adapter to store data in an attribute named `__annotations__`.

     """

Some give describe how the object will _act_: Persistent.  Some are 
application-level statements about how what is allowed to be _done_with_ 
the object: ISharable (the user can "share" this object with other users 
in various ways; read, write, etc.).

These (especially the marker interfaces) don't seem to be statements 
about what the objects can do (abilities), but about other 
characteristics, therefore a more general name like "interface" seems 
appropriate.
--
Benji York


More information about the Python-3000 mailing list