Hi, I’m new to numba.
It seems that if in dict. keys () cannot be used to determine whether there is a key in the dictionary. For example, the following code will report an error.
from numba import njit
from numba.core import types
from numba.typed import Dict, List
d = Dict.empty(key_type=types.unicode_type, value_type=types.ListType(types.int64))
d[‘posx’] = List([1, 5, 2])
d[‘posy’] = List([5, 3, 2])
@njit
def printdict(d):
if ‘posx’ in d.keys():
print('posx: ', d[‘posx’])
print('posy: ', d[‘posy’])
printdict(d)