[Zope3-dev] Re: adding None to flattened interfaces
Jim Fulton
jim@zope.com
Tue, 19 Nov 2002 09:28:58 -0500
Steve Alexander wrote:
> Jim,
>
> http://lists.zope.org/pipermail/zope3-checkins/2002-November/001315.html
>
> Why would you want to include None in the output of flattened interfaces?
None is the "null" interface. An interface spec implicitly includes this interface.
(It's a bit like the null set being s subset of every set.)
When you register an adapter that applied to all components, you register it for
Interface.Interface. When you want to register an adapter for all objects, including
all components, you ommit the for interface and, under the hood, None is used.
This means that when we are searching for matching registrations, we need to include
None last.
Before this change, the search routines would check None after checking the interfaces
returned by _flatten. With this change, the code is simpler.
Jim
--
Jim Fulton mailto:jim@zope.com Python Powered!
CTO (888) 344-4332 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org