[Zope-dev] ExtensionClass question

Michel Pelletier michel@digicool.com
Thu, 24 Feb 2000 17:33:13 -0800


James Henstridge wrote:
> 
> On Thu, 24 Feb 2000, Michel Pelletier wrote:
> 
> > James,
> >
> > I read your message but at the time it wasn't quite clear to me what was
> > needed.  I'm no ExtensionClass expert, but I might be able to help.
> >
> > Since your developing a large C extension module and I'm not, I'm going
> > on the assumption that you know more about this than I do, but I was
> > under the impression that classes cannot be defined in C, only types.
> > Therefore, I'm not sure exactly how one would 'subclass' in C, or how
> > one generalizes one C type with another.  It is possible of course to
> > create a type that is an extension class, as detailed in the extension
> > class docs and examples.  Perhaps you could explain what you need
> > better?
> >
> That is the whole point of ExtensionClass -- to create python types in C
> that look like classes so they can be subclassed.  This is a very
> useful feature, and I wanted to see if I could use ExtensionClass to add
> this functionality to one of my projects.

Ah, I think I see where you're coming from, the point of ExtensionClass
is to make C types look like classes in Python, but in C they are still
types, and there is no mechanism to generalize one type with another, at
least not to my knowledge.  Quote the ExtensionClass docs:

>     **Note:** I use *non-standard* terminology here.  By standard
>     *python* terminology, only standard python classes can be called
>     classes.  ExtensionClass "classes" are technically just "types"
>     that happen to swim, walk and quack like python classes.

So if I understand your original question right (which I may not), you
want to use some sort of mechanism in C to generalize one ExtensionClass
type with another *in C*.  I don't think this is possible (it might be
possible with some sort of C++ mechanism, but I haven't delved into that
beast of a language in years...).

-Michel