Traits/Roles in Python 3000?
The PEP submission deadline for Python 3000 has just ended. One idea really caught my eye: Traits/Roles instead of ABCs. (ABC means abstract base class.)
I fiddled with the ideas that would become roles in 2003 and 2004 before Allison Randal handed me a copy of the Smalltalk Traits paper and asked "Is this what you were trying to tell everyone?" Since then, we added them to Perl 6 (see Apocalypse 12).
I'm very pleased to see Collin Winter's proposal (and his reference to Roles: Composable Units of Object Behavior. The concept is very powerful and--if applied throughout the entire system--provides a different and more flexible way of thinking about types and objects and classes.
I still stand by my warning about redesigning a programming language, however much in the spirit of good-natured ribbing. Integrating powerful new concepts cleanly may require and inspire further changes.
There is a traits package for the current Python and it seems pretty good:
|Michael R. Bernstein
Check out Jeff Shell's comparison with zope.interface: