Yet Another PEP: Query Protocol Interface or __query__

Aahz Maruch aahz at
Wed Mar 21 05:33:44 CET 2001

In article <slrn9bgb7f.kam.neelk at>,
Neelakantan Krishnaswami <neelk at> wrote:
>On 20 Mar 2001 17:47:35 -0800, Aahz Maruch <aahz at> wrote:
>>In article <Pine.LNX.4.21.0103201837570.21343-100000 at>,
>>Clark C. Evans <cce at> wrote:
>>>    A new built-in method, __query__ is proposed.  This method has
>>>    a single argument, an interface protocol identifier, and either
>>>    returns an object supporting the given protocol, or throws an
>>>    unknown exception. [...]
>> [...]
>> Most importantly, how does one find out what interfaces an object *does*
>> support?
>Why is this important?
>If you are writing some client code, presumably all you care about is
>that the object you receive supports certain interfaces X, Y and Z
>that you are using. It wouldn't seem to matter at all what -other-
>interfaces it supports.

I had a horrified reaction to the idea of looping over X, Y, and Z
wrapped around a try/except.  Because Clark is now changing the
exception to None, my point is considerably less important.
                      --- Aahz  <*>  (Copyright 2001 by aahz at

Androgynous poly kinky vanilla queer het Pythonista
Hugs and backrubs -- I break Rule 6

"I won't accept a model of the universe in which free will, omniscient
gods, and atheism are simultaneously true."  -- M

More information about the Python-list mailing list