[Zope3-dev] capi vs zapi

Jim Fulton jim at zope.com
Mon Mar 7 12:33:38 EST 2005


Stephan Richter wrote:
> On Friday 04 March 2005 13:23, Garrett Smith wrote:
> 
>>I noticed the new 'capi' -- when should this be used instead of zapi?
>>
>>I'll add that info to changes.txt if any cares to enlighten :)
> 
> 
> capi is a short form for zope.component and should only be used when zapi 
> cannot be used. For example, you cannot use zapi in zope.app.traversing, 
> because this package is part of zapi. Another use case is when you develop a 
> package that does not depend on zope.app, then you must use the component API 
> directly.

I don't like capi.  In fact, I don't like using "import ... as somename"
unless a rename is necessary to avoid a name conflict.

I prefer:

   from zope import component

   ...

   utility = component.queryUtility(...)

Here, it's quite clear what component is.

Please don't consider "capi" a standard pattern.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list