[Zope3-dev] Interface declaration API
Phillip J. Eby
pje@telecommunity.com
Mon, 10 Mar 2003 20:01:41 -0500
At 01:00 PM 3/10/03 -0500, Jim Fulton wrote:
>I'd be interested in how prople feel about one of these vs the other.
You probably already know how I feel about the spelling. :)
I have a minor question about semantics, though. In the docs for the
querying functions, it appears that a new declaration is created if none
exists, yet it also says in the Wiki proposal that (in effect) a
declaration is inherited if none exists. What happens if you query the
declaration for a class (implementedBy/classInstancesInterfaces) which has
no declaration? Do you get a declaration that is a copy of the inherited one?
I'm also curious whether the default interface spec for a class' instances
should perhaps be the union of the interfaces specified by __bases__,
rather than flat inheritance in __mro__-first order. It seems to me that
it would best serve the common case for multiple inheritance, and be
closest to what I believe is the view Guido has expressed in the past
regarding what would be "Pythonic" for inheritance of interface specifications.
I'm also curious whether it might be acceptable to have 'alsoImplements()'
and 'doesNotImplement()' functions that could be used in a class body to
add to or subtract from the inherited declarations. It might be nice if in
Python 2.4 we could use these things like this:
class Foo(Bar,Baz) [alsoImplements(ISpam)]:
...
But all of this is just idle vaporware and should not be construed as a
reason to hold up the current proposal, which is fine by me. :)