[Twisted-Python] New components questions
James Y Knight
foom at fuhm.net
Fri May 7 19:10:49 EDT 2004
On May 7, 2004, at 6:14 PM, Itamar Shtull-Trauring wrote:
> 1. Currently, if c is a Componentized, IFoo(c, persist=False) will
> bypass c.getComponent() and do standard lookup. Is it worth supporting
> this at all? It'd make code cleaner if not, and integration with
> zope.interface easier.
No. The only places I've seen persist=False used, it's been a pure
optimization. E.g. "I know I never want persistence, don't bother
checking for me". I don't think anyone would cry if it went away. At
least, I *hope* noone has been insane enough to depend on it.
> 2. How do we package zope.interface package? We could:
> a. include copy of code, as e.g. twisted.interface, and have it
> replace itself with zope.interface if that exists. This opens
> us to possible _xmlplus style horribleness.
> b. install zope.interface in our setup.py if it doesn't exist.
> c. tell people to install it themselves.
I'd say "b", especially since "c" doesn't appear to be possible at all
right now? For packaged versions, we should of course not include
zope.interface at all, but simply depend on its package.
> 3. Do we want our own adapter registry or not? Zope's global registry
> in zope.component, which is a whole new package we need to install and
> backport to 2.2. And it has lots of other stuff which while interesting
> and possibly useful means more cognitive overhead. My current code has
> its own registry and does not require zope.component. The downside is
> that if we have our own registry, code that uses both Twisted and
> zope.component will cause adaptation to an interface will be slower
> because it will need to check two registries.
Wait, isn't the recommended path for new code that uses twisted
supposed to be "use zope directly, not our compatibility wrappers"? How
can we say that if we don't use/support the standard zope registry?
What is the actual downside to using their registry? You don't have to
tell people about all the crazy stuff you can do with it, just the one
"registry adapter" call that they actually need.
More information about the Twisted-Python