Making Extensions?

Tim Peters tim_one at email.msn.com
Wed Sep 20 02:22:54 EDT 2000


[Samuel A. Falvo II]
> ...
> The problem is I want to make a new "type" under Python.  How the
> bloody heck do I do this in C?  I've got tutorials that indicates
> how to make a Python extension, but not an extension *type* (that
> is, the ability to instantiate an object with methods).

You do know that Python is implemented in C, right?  So take a look at how
Python does it.  For example, the list type is implemented by listobject.c,
unbounded integers by longobject.c, and so on.  Particularly look at
xxobject.c, which begins

/* Use this file as a template to start implementing a new object type.
   ...

All in the Objects subdirectory of the source distribution.

ain't-a-question-of-docs-it's-a-question-of-code<wink>-ly y'rs
    - tim





More information about the Python-list mailing list