[Pyrex] Extending collections.defaultdict
Robert Bradshaw
robertwb at math.washington.edu
Thu Apr 2 13:21:28 CEST 2009
On Apr 2, 2009, at 4:17 AM, Franck Pommereau wrote:
> Hi all,
>
> I would like to create in Cython/Pyrex a new type by extending
> collections.defaultdict class. I've found that I can extend dict by
> using :
>
> cdef extern from "dictobject.h":
> ctypedef class __builtin__.dict [object PyDictObject]:
> pass
>
> cdef class hdict (dict):
> ...
>
> But there is no header file such as "dictobject.h" for module
> collections nor I could find one that declares defaultdict.
>
> Does anyone knows how I could declare the existence of defaultdict?
I PyDictObject is #included into the standard Python.h file, so you
could probably just get it from there. You need to make sure you have
the development version of Python installed.
- Robert
More information about the Pyrex
mailing list