I need to have an array of python objects that will be used when creating the trie data structure. I need a structure that will be a fixed length as a tuple and modified as a list. I donβt want to use the list because I want to be able to make sure that the list matches the size exactly (if it starts to allocate additional elements, the memory overhead can add up very quickly as the trie gets bigger). Is there any way to do this? I tried to create an array of objects:
cdef class TrieNode: cdef object members[32]
... but this gave an error:
Error compiling Cython file: ------------------------------------------------------------ ... cdef class TrieNode: cdef object members[32] ^ ------------------------------------------------------------ /Users/jason/src/pysistence/source/pysistence/trie.pyx:2:23: Array element cannot be a Python object
What is the best way to do what I'm trying to do?
Jason baker
source share