On Wed, Aug 25, 2010 at 4:05 AM, Stefan Behnel <[email protected]> wrote: > Greg Ewing, 25.08.2010 12:54: >>> Craig Citro, 25.08.2010 10:00: >>> >>>> * bool is no longer a valid type name by default. ... >> > Both types are available for importing: >> >> What happened to the idea of treating bool like int? > > That's orthogonal. The case of 'bool' as a type only applies to type > declarations and doesn't work "as expected" when dealing with C++ code > because some users expect the C++ 'bool' type and others expect the Python > type. Thus, 'bool' was removed as a Cython type and you have to be explicit > about what you use.
It should also be noted that g++ happily accepted PyObject* (the pointer pointer) in a bool context and would convert bools into (PyObject*)0 and (PyObject*)1, > There are two places where 'bool' values are treated as ints: the literals > True/False are treated as ints (or 'bint', actually), and users can declare > variables as 'bint' explicitly. Both work nicely and match well with the > 'bool' use cases. Yes, we still have the bint which is still recommended for use (bool doesn't even exist for non-C++ code). It is semantically a bit different, as bint has many truth values (anything but 0) but bool has only one truth value (C++ automatically converts any non-zero value to 1). - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
