what is different between PyLongCheck and PyLongCheckExact
Jump to turn (11)
- 1what is different between PyLongCheck and PyLongCheckExact
- 2CPython中如何判断string类型
- 3CPython如何判断传入的PyObject是不是PyNone
- 4how to use PyLongFromVoidPtr
- 5使用printf应该如何输出uint8t的数据,比如uint32t应该使用%u,uint16t该使用%hu
- 6CPython应该如何输出string
- 7CPython中如何构建一个dict
- 8glsl 中的fract函数
- 9请将以下的英文翻译为中文: where r is the index of the ray pair being processed. You can incr
- 10what is halton sequence
- 11manimlib 创建一个半径为0.5的圆
- User
what is different between PyLong_Check and PyLong_CheckExact
- Assistant
PyLong_Check and PyLong_CheckExact are both functions in Python's C API for working with integers, specifically Python long integers.
The main difference between them is that PyLong_CheckExact requires the object to be an exact long integer object, while PyLong_Check will return true for any object that behaves like a long integer.
PyLong_Check will return true if the object is a long integer or an object that can be converted to a long integer. For example, a float object can be converted to a long integer so PyLong_Check would return true for a float object as well.
On the other hand, PyLong_CheckExact will only return true if the object is an exact long integer object. This means that it must be a PyLongObject or a subtype of PyLongObject.
In summary, PyLong_Check is a more general check for integer-like objects, while PyLong_CheckExact is a more strict check for exact long integer objects.