I got a compute intensive task which does some filter job for many times.
Things like this:
# (a large dictionary with a length of about 1m , value could be any python type , keys are all strings.)
dictionary = {'a':1 , 'b':[] , ...}
for i in range(1e6):
Filtered(dictionary, 'b') # -> which is expected to return [] in this particular case.
And I would like to take advantage of cython. Got a problem here is if there's any way to convert this python sturcture into c style , if there're some kind of pointer that can points to any python object , so that I can simply get input and return stuff intact to simply solve this problem?
Expect something like this:
cdef filter(pydictionary , pystr):
cdef map[void *] dictionary = pydictionary
cdef string str = pystr
# ... some filter stuff
result = dictionary[str]
return result
Is that possible to achieve? Thanks.