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. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
