[Zope] Sub Class Question

Loren Stafford lstaffor@dynalogic.com
Sun, 27 Aug 2000 20:26:44 -0700


From: "R. David Murray" <bitz@bitdance.com>


> On Sat, 26 Aug 2000, Loren Stafford wrote:
> >   def index_object(self):
> >     if self.nextEventTime() is not None:
> >         CatalogAware.index_object.im_func(self)
> >         # see Python Reference Manual "The standard type hierarchy"
> >         # for the built-in type im_func
>
> I realize this is a Python and a not a Zope question, but
> what is the difference between
>
>   CatalogAware.index_object.im_func(self)
>
> and
>
>   CatalogAware.index_object(self)
>
> ?
>
> --RDM
>

Here's what MJ told me about that case. I'm not sure it applies to your
case. Did you try it? Did it work?

-- Loren

----- Original Message -----
From: "Martijn Pieters" <mj@digicool.com>
To: "Loren Stafford" <lstaffor@dynalogic.com>; "zope-dev"
<zope-dev@zope.org>
Sent: March 01, 2000 11:57 AM
Subject: [Zope-dev] Re: What is im_func?

> From: "Loren Stafford" <lstaffor@dynalogic.com>
> > Could you elaborate on what im_func is and what it's role is here.
> >
> >     # 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
>