-3

Writing a Python extension module which is intended to speed up execution of a function written as Python script I am stuck with the problem of how to check in C-code of a Python extension module if a C-Python object is in a C-Python set/list of C-Python objects.

In other words what I am looking after is the equivalent of Python script expression item in list/set in C code of a Python extension module.

Any hints how to accomplish this are welcome.

Claudio
  • 7,474
  • 3
  • 18
  • 48

1 Answers1

1

int PySequence_Contains(PyObject *o, PyObject *value)

Determine if o contains value. If an item in o is equal to value, return 1, otherwise return 0. On error, return -1. This is equivalent to the Python expression value in o.

source

Community
  • 1
  • 1
Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358