In looking over the code for ZWiki/ZC, I see a lot of places with the 
following construct:
apply(foo.__call__, some, arguments)
Why not just say
foo(some, arguments)?

Examples of the construct from
                       (None, REQUEST, REQUEST.RESPONSE))
            apply(DTMLDocument.__call__,(self, self.aq_parent,
                                              REQUEST, REQUEST.RESPONSE))

[OK, in this case the question technically is why use apply(foo.__call__, 
(a, b, c)) instead of foo(a,b,c)? Hmmm..., b, c) -> foo.__call__(x, a, b, c).]

These requests are mostly, if not entirely, directed at 
WikiPages/Headers/etc, whose definition is, in part,
class ZWikiPage(DTMLDocument): #, CatalogAware):
     def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
         """Render a zwiki page, with standard header & footer

I thought the use of keyword argument dictionaries in apply might explain 
this, but, as the two opening examples show, not all cases have 
keywords.  Second, even if they do one could say
aDocument(self, REQUEST, REQUEST.RESPONSE, kw).

I understand from Johan that this is "inherited" code (in the non OO 
sense), so I thought I'd throw this out as a general question.  Is there 
some subtlety of the interaction of Zope (acquisition, perhaps, or 
extension classes in general) and python that makes foo(x) and 
foo.__call__(x) have different meanings?
Is it something about standard_zwiki_page, which I notice is not a regular 
python variable?

I don't need the answer to this to do something; I'm just trying to 
understand how things work.


Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to