On Sep 3, 2009, at 2:58 AM, Sanne Korzec wrote:
> Personally, I would implement a simple extension class
>
> cdef class MyDoubleHashtable:
> cdef void put(double key, double value)
> cdef double get(double key)
> ...
>
> - Robert
>
>
> If you do this, you are still using python objects. E.g.
>
> Self.dict = {}
> cdef void put(double key, double value):
> self.dict[key] = value
Yes, that wouldn't help. I was thinking of implementing the table
itself on top of double pointers.
> But how do I import the c code in python, so I can do something
> like this:
>
> Import c_hash_table
>
> cdef void put(double key, double value):
>
> //call the c hash table
>
> I can't find any examples on how to use this.
See http://docs.cython.org/docs/external_C_code.html . Once you
declare these external functions, you can use them in your Cython
code just like any function you defined.
- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev