Could you elaborate on what im_func is and what it's role is here. Does it have to do with mapply? I see it used there, but don't understand what's going on. # Only index if nextEventTime returns something def index_object(self): if self.nextEventTime() is not None: CatalogAware.index_object.im_func(self) -- Thanks -- Loren
From: "Loren Stafford" <lstaffor@dynalogic.com>
Could you elaborate on what im_func is and what it's role is here. Does it have to do with mapply? I see it used there, but don't understand what's going on.
# Only index if nextEventTime returns something def index_object(self): if self.nextEventTime() is not None: CatalogAware.index_object.im_func(self)
im_func is a part of Python introspection. It is the pure function definition of a class, not bound to that class, so I can pass in an alternate self. I am trying to call a superclass method here, and normally CatalogAware.index_object() would suffice. But because of Extension Classes, Python gets confused as to what is a class method, and what is a regular function. It will accuse me of calling an unbound method, which of course I am not. I circumvent this by calling the unbound function, and passing in self explicitly. Martijn Pieters | Software Engineer mailto:mj@digicool.com | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ | The Open Source Web Application Server ---------------------------------------------
participants (2)
-
Loren Stafford -
Martijn Pieters