handling boolean values from a c api

Alex Martelli aleax at aleax.it
Mon Mar 24 06:06:00 EST 2003


Bryan wrote:
   ...
> also, will PyInt_Check be forwarded compatible with the new 2.3 True
> and False values?  for example, in 2.3 will
> PyInt_Check(some_True_object) also return 1?

Yes, bool is a subclass of int exactly to ensure this (there IS a more
specific PyInt_CheckExact if you want to check for type IDENTITY, not
subclassing).  But anyway, as Gerhard already answered to the first
part of your question, PyObject_IsTrue is what you really want.


Alex





More information about the Python-list mailing list