[c++-sig] Digest Number 36

David Abrahams abrahams at mediaone.net
Sun Sep 24 13:43:15 CEST 2000


----- Original Message -----
> Message: 1
>    Date: Sat, 23 Sep 2000 13:31:10 -0700
>    From: Jonathan Greene <jgreene at adaptivesilicon.com>
> Subject: Python classes with methods that are C extensions?
>
> I know one can extend Python with C functions in two ways:
> 1. Modules with functions that are C functions.
> 2. Extension types with methods that are C functions
>
> Is there also a way to have true Python classes (not types) whose
> methods are C functions? I've heard rumors that  there have been changes
> to Python since 1.5.1 that make this possible but have seen nothing in
> the documentation.
>
> Note: It is possible to write a class method in Python that calls a C
> function (as SWIG does). But I would like to avoid this approach since
> it involves a 2nd function call and thus worse performance.

Well, I can get you pretty close. See
http://people.ne.mediaone.net/abrahams/downloads/py_cpp.html.



More information about the Cplusplus-sig mailing list