Yet Another PEP: Query Protocol Interface or __query__
Aahz Maruch
aahz at panix.com
Tue Mar 20 23:33:44 EST 2001
In article <slrn9bgb7f.kam.neelk at alum.mit.edu>,
Neelakantan Krishnaswami <neelk at alum.mit.edu> wrote:
>On 20 Mar 2001 17:47:35 -0800, Aahz Maruch <aahz at panix.com> wrote:
>>In article <Pine.LNX.4.21.0103201837570.21343-100000 at clarkevans.com>,
>>Clark C. Evans <cce at clarkevans.com> 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 pobox.com)
Androgynous poly kinky vanilla queer het Pythonista http://www.rahul.net/aahz/
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