[Extensions] Checking for type

Gerhard Häring gh_pythonlist at gmx.de
Fri May 31 04:43:05 EDT 2002


* Gerhard Häring <gh_pythonlist at gmx.de> [2002-05-31 10:04 +0200]:
> Currently, I'm checking for the type with:
> 
>     if (function_result->ob_type == &PyInt_Type)
> 
> I'd rather use the C-API equivalent of
> isinstance(function_result, IntType) but there doesn't seem to be one
> that's compatible with Python 2.1, too.
> 
> Any suggestions?

Use PyInt_Check.

HTH,

Gerhard
-- 
This sig powered by Python!
Außentemperatur in München: 17.1 °C      Wind: 2.5 m/s





More information about the Python-list mailing list