Dictionary search in scipy weave

I am working on a project to optimize an algorithm that contains a huge for loop, but needs to be called in Python, so I use the scipy weave tool. One of the lines of code that I have is in Python:

if entry not in a_set: #do something 

I want to continue the constant search time as a set, so I was going to use the dictionary to speed up the search time. I need to perform the same functionality in my C ++ code. I have to pass the set as an argument.

  • Is this the only way to do this with dict ( py::dict )? And if so, how can I call the insskey (key) function in the inline C code? Do I need to use a python call for this function?

  • Is there any other way / data structure that I could use as indicated in the scipy weave?

The link I'm based on is: https://github.com/scipy/scipy/blob/master/scipy/weave/doc/tutorial.txt

+4
source share

All Articles