Yet Another PEP: Query Protocol Interface or __query__

Alex Martelli aleaxit at yahoo.com
Sun Mar 25 16:59:00 EST 2001


"Magnus Lie Hetland" <mlh at idi.ntnu.no> wrote in message
news:99lnc6$ck4$1 at tyfon.itea.ntnu.no...
    [snip]
> >     To enable the first case listed in the requirements,
> >     the adapt function first checks to see if the objects
> >     type or the objects class are identical to the protocol.
> >     If so, then the adapt function returns the object directly
> >     without further ado.
>
> Hm. So in some cases the protocol object is merely an example
> (prototype) of an object satisfying the protocol, and in other

I suspect a mis-reading here.  What I read is 'type or class
identical to the protocol', i.e. the protocol can be a type object
or class object; NOT 'identical to *that of* the protocol'.

Maybe the wording needs clarification (make more explicit).


> How about __adjust__? Sounds more transitive than __adapt__ to
> me...

Or __accept__.

>   __conform__ - method in an object which can conform to
>                 a protocol
>   __adapt__   - method in a protocol used to adapt an
>                 object to it

Agree, probably best.


Alex






More information about the Python-list mailing list