On Fri, Apr 17, 2009 at 4:13 PM, Lisandro Dalcin <[email protected]> wrote: > On Fri, Apr 17, 2009 at 10:51 AM, Riccardo Murri <[email protected]> > wrote: >> I cannot get the documented method to work:: >> >> $ cat t.pyx >> cdef extern from "tupleobject.h": >> ctypedef class __builtin__.tuple [object PyTupleObject]: >> pass >> >> cdef class MyTuple(tuple): >> pass >> > > Tuples are a different beast... They are PyObject_VAR_HEAD structures > (like strings in Py2, and perhaps in Py3 in the future, no right > now)... > > typedef struct { > PyObject_VAR_HEAD > PyObject *ob_item[1]; > } PyTupleObject; > > Cython cannot currently handle this... >
Thank you very much! I have updated the Wiki page, stating that not only strings but also tuples cannot be subclassed: http://wiki.cython.org/FAQ/cdef_derive#preview Riccardo -- Riccardo Murri, via Rossée 17, 6987 Caslano (CH) _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
