On Fri, Dec 18, 2009 at 8:07 PM, Robert Bradshaw <[email protected]> wrote: > On Dec 18, 2009, at 2:41 PM, mark florisson wrote: > >> Hello, >> >> Currently, bint Cython types get converted to int Python objects >> when accessed in Python code as attributes of an object, and I think >> it would be more consistent and logical to have it return actual >> bool objects (for instance if you return a bint from a function or >> method it gets converted to a bool). > > I agree, that's a bug. > >> So instead of storing a bint as an int, it could be stored as a >> char, and the T_BOOL macro name could be used in the PyMemberDef to >> have it automatically converted to True/False. I have included a >> patch that does this, but this obviously causes overflows for code >> that assigns values that don't fit in a char. I'm not sure if that's >> an issue, if it is, could we perhaps generate get/set methods that >> return a bool object when accessed from python code? > > > For consistency, at least as things are now, we should store it as an > int. However, we could generate custom get/set methods as we do with > attributes that are typed as builtin or extension types. >
Or use custom get/set for everything... IIRC, we discussed about this in the past. -- 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
