Wow... I'm very sorry. I got it totally wrong ... If the change you are proposing about simplifying the type system only affect that, I'm actually +1 on your proposal. The canonical Python way is a mess in the context of Cython.
I would just ask for the following: 1) When going from C to Python, for Python 2.X, try to avoid returning a PyLong (basically dispach proper calls using sizeof(type)<=sizeof(long) ) 2) Use __Pyx_T_FLOATING, just to avoid confussion. Of course, other way would be to just use the transform I proposed previously. I do not expect it to impact performance. On Thu, May 14, 2009 at 5:05 PM, Dag Sverre Seljebotn <[email protected]> wrote: > Lisandro Dalcin wrote: >> On Thu, May 14, 2009 at 4:08 PM, Dag Sverre Seljebotn >> <[email protected]> wrote: >>> Robert Bradshaw wrote: >>>> Does this have a performance impact compared to the other way? It >>>> does bloat the code some. (Maybe it's not critical anyways.) >> >> Give me a bit more of time to give a definitive comment on this, but ... >> >>> Well, it is only used for external typedefs, and considering that the >>> bug is quite critical (basically it's very easy to do *(long >>> long*)&some_short)... >>> >>> Haven't benchmarked it, we could consider switching to my original >>> proposal later.. >>> >> >> ... as long as the "property" is defined with a C protocol (instead of >> the Python-side "property" builtin), I do not expect a impact on >> performance. >> >>> Lisandro, would you like to argue why you were -1? >>> >> >> For the same rationale that othes gave on this thread (basically, the >> impact on C semantics), and because I believe a better and backward >> compatible solution can be found. >> >> Simplifying the whole type system seems a mistake to me, in the >> temptation to guess, I would just guess ONLY in the case of external >> ctypedef's. Moreover, we could extend this to make "ctypedef signed >> value" as an unknown-size integral, but if the code does "ctypedef int >> value", assume that the ctypedef is actually a "int" and treat it like >> that. Of course, we have a problem with floating poing. Then perhaps, >> you should enable a special declarations for integrals and floatings >> like this: >> >> ctypedef signed integral i >> ctypedef unsigned integral j >> ctypedef floating x # or "floatingpoint", or "inexact" >> >> and ONLY in such case we treat such declarations as unknown-size types. >> >> Does this make sense? > > Sure :-) But I was mainly referring to > > """ > My suggestion for a fix here is to replace all T_INT, T_UINT etc. with > simply three types: __Pyx_T_SIGNED, __Pyx_T_UNSIGNED, __Pyx_T_FLOAT. > These would use sizeof to determine the right type to flag the extension > type property as (like Lisandro did with T_SIZET already does). > """ > > This is ONLY used when you do > > cdef class A: > cdef public sometype FOO > > I.e. in my point (A) I was only arguing collapsing types for the purpose > of exporting properties (through the CPython member structures). > > If you misunderstood my intentions I suppose that answers the question... > > Dag Sverre > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev > -- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
