[Python-3000] Abilities / Interfaces: why not adapt()?

Nick Coghlan ncoghlan at gmail.com
Tue Nov 21 16:28:02 CET 2006


Paul Moore wrote:
> On 11/21/06, tomer filiba <tomerfiliba at gmail.com> wrote:
>> adaptation is much more capable ("don't complain, do something
>> about it") and reflective (both the protocol and the instance can
>> perform the adaptation) so you don't have to explicitly inherit
>> from many base classes or interfaces.
>>
>> i'm very +1 on reviving adapt() and dropping all those "i want
>> strongly-duck-typed interfaces in python" talks.
> 
> To some extent I agree, but I also think that generic functions are
> even more flexible. (As per the previous discussion which started
> covering adaptation and moved on to generic functions).
> 
> I'd like to see some clear evaluation of the pros and cons of the 3 -
> interfaces, adaptation, and generic functions. My feeling is that they
> are to some extent "competing" proposals, and we need agreement (or
> BDFL ruling!) on which is the way forward, before we start discussing
> specifics.

The BDFL has favoured function overloading (aka generic functions) pretty 
heavily in previous rounds of this discussion, but more formal interfaces may 
still form a significant part of that as an efficient means of dispatching to 
the different overloaded operations.

Multi-argument dispatch plus interfaces is likely to be cleaner than trying to 
do everything based on concrete types. But this really needs more input from 
the enterprise framework folks (PEAK, Zope, etc), as that's the level this 
feature is really aimed at. Quick & dirty scripts are unlikely to need it any 
more than they do now :)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list