1. Why not to simplfy the problem. You can extract values from the dictionari in python (this is fast). Put them in a list (fast). Pass the list to the extension, handle it and return to python. etc. 2. Use Pyrex.