I'll jump in and answer you questions.

On Feb 21, 2007, at 10:18 AM, Robert Miller wrote:

> David,
>
> I was wondering if you could help get me started here. I've been
> reading the Python/C API, and I've been browsing both sides of a lot
> of Pyrex: for argument's sake, let's say the Complex double matrices.
> First, I'm wondering how they're cdef-ing classes that they're then
> calling from Python.

cdef has two uses. The first is to declare a class as an extension  
type (so it can contain cdef'd property and functions), and the  
second is to declare a property/function as a c type. Cdef'd  
extension types are accessible from python, just not their cdef'd  
properties/functions.

> Also, what do .so files in site-packages have to
> do with specific classes in the repository?
>
> (
> sage:  
> sage.matrix.matrix_complex_double_dense.Matrix_complex_double_dense??
> Type:           type
> Base Class:     <type 'type'>
> String Form:    <type
> 'sage.matrix.matrix_complex_double_dense.Matrix_complex_double_dense'>
> Namespace:      Interactive
> File:
> /Volumes/DATA/sage/local/lib/python2.5/site-packages/sage/matrix/ 
> matrix_complex_double_dense.so
> )

Each .pyx file has an associated shared object library containing all  
the classes/methods/etc. needed.

>
> I have some questions also about reference counting, but let's  
> start here.....

You shouldn't have to worry about it too much. Basically, if you  
malloc something manually, you have to worry about freeing it. If you  
call the C/Python API directly (which you probably won't need to do),  
you have to worry if the returned PyObject* is a borrowed or new  
copy. But otherwise pyrex will take care of it all for you.

>
> -- 
> Robert L. Miller
> http://www.robertlmiller.com/
>
> 

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to