handling boolean values from a c api

Bryan belred1 at yahoo.com
Sun Mar 23 19:37:30 EST 2003


i have a function in python that returns a boolean.  i'm currently
using PyInt_Check to verify the return value, but this limits me to
integers and True/False (in 2.2).  is there an easy way to tell the
boolean value of any aritrary object in 2.2? for example [] is false
and ['x'] is true and "" is false and "xxx" is true.

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?

thanks,

bryan




More information about the Python-list mailing list