I have a numpy structured array and pass one element in it to a function as below.
@njit
def process(a):
# some work
a[0] # works
i = 0
a[i] # works
a[i+1] # does not work
I can confirm that a is indeed a Record, instead of sth else like an array etc. It seems like indexing is only allowed by a constant, which can be an integer or a CharSeq, known at compile time, but not an expresson on the constant, which is also known at compile time though. May I know what is happening under the hood?
I have tried other constant as index like “j=i; a[j]”, which also works. But unsurprisingly “j=i+1;a[j]” fails.
2