我尝试在需要数组的函数中使用Pythranint
,而对于第二个 arg a dict
,其元组为ints
as 键和int
as 值:
myarray = np.array([[0, 0], [0, 1], [1, 1],
[1, 2], [2, 2], [1, 3]])
dict_with_tuples_key = {(0, 1): 1, (3, 7): 1}
通知Pythran的正确方法是什么dict
?:
#pythran export update_dict((int, int):int dict, int[][])
def update_dict(dict_with_tuples_key, myarray):
# do something with dict_with_tuples_key and myarray
# return and updated dict_with_tuples_key
return dict_with_tuples_key
使用(int, int):int dict我得到这个错误:
File "/usr/lib/python2.7/inspect.py", line 526, in findsource
file = getfile(object)
File "/usr/lib/python2.7/inspect.py", line 403, in getfile
raise TypeError('{!r} is a built-in module'.format(object))
TypeError: <module 'sys' (built-in)> is a built-in module