Nick Coghlan wrote:

> In this case, it makes far more sense to me to move the adapter 
> registration out to the individual protocols.

That would alleviate some of my concerns as well. This
seems more Pythonic: Namespaces are one honking... etc.

> In a glorious fit of self-referentiality, one of the first things needed by 
> such an approach would be a protocol for the protocol interface that allowed 
> other protocol objects to register themselves as implementing it. This would 
> then allow the ever popular generic adaptation function to be written as:
> 
>    def adapt(obj, target_protocol):
>        return Protocol.adapt(target_protocol).adapt(obj)

Surely the protocol protocol would be well-known enough
that other protocols would simply be duck-typed to it,
rather than having to be adapted to it?

Also I prefer the idea of the protocol object being
callable, so you just do

   target_protocol(obj)

to do an adaptation.

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,          | Carpe post meridiam!                 |
Christchurch, New Zealand          | (I'm not a morning person.)          |
[EMAIL PROTECTED]          +--------------------------------------+
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to