I have an existing Python codebase that looks a bit like this:
class Lexicon
def __init__(self, ...):
self._mv = memoryview(...)
... elsewhere ...
lexicons # list of lexicons
for word in words:
lexicon_index = get_lexicon_index(word)
xxx = lexicons[lexicon_index]._mv[word.id]
The number of lexicons is small, often just one, but that's only known at runtime.
I'd like to have a list or array of the memoryviews in Cython-space, since I don't need other properties on the lexicons, but I'm having trouble with the type signatures. What's the right way to do this?