[Python-3000] Abilities / Interfaces

Phillip J. Eby pje at telecommunity.com
Thu Nov 23 19:31:56 CET 2006


At 10:14 AM 11/23/2006 -0200, Gustavo Niemeyer wrote:
>This is true for generic functions as well, except that
>instead of using an IFruit interface, you have a fruit()
>generic function which handles the adaptation.  Unfortunately,
>this model doesn't work with more complex hierachies.

You've got that backwards, actually; generic functions can work with 
"recombinant" hierarchies, where traditional interfaces can't.  See Guido's 
repost of my explanation under the "Generic functions vs OO" thread.  In 
it, I present a short "Interface" implementation based on generic functions 
that provides universal adaptation for arbitrary interface hierarchies, 
including subset interfaces -- *without having to write adapter classes*:

http://mail.python.org/pipermail/python-3000/2006-November/004746.html



More information about the Python-3000 mailing list