Extending Python classes

Martin von Loewis loewis at informatik.hu-berlin.de
Mon Dec 24 00:59:04 CET 2001


"Steven Feil" <sfeil at io.com> writes:

> Question 1: In the document "Extending and Embedding the Python
> Interpreter", there is a chapter called "Defining new types". What is
> the difference between a "Type" and a class in python?

A class is an object whose type is <type 'class'>. A type is an object
whose type is <type 'type'>. Notice that it Python 2.2, "new-style"
classes are also types.

> Question 2: Is there a way to associate an instance of a class with a
> C-Language pointer?

An instance of a class is always associated with a C language pointer,
of type PyObject*.

> If these questions don't make since here is an explanation of what I
> have now and what I am trying to acomplish.....

Your questions are meaningful and have meaningful answers. Perhaps you
still wanted to ask different questions.

Regards,
Martin



More information about the Python-list mailing list