I want to implement n-tree by using list of nodes and jitclass but using deferred type for list but it is not possible(error is down below). If it needs additional functionality ,i need to report. Can you help?
TypingError: List.item_type cannot be of type OptionalType(DeferredType#1744333178288) i.e. the type ‘DeferredType#1744333178288 or None’
node_type = deferred_type() @jitclass([('data', int32), ('children', types.ListType(optional(node_type)))]) class Node(): def __init__(self,key): self.data=key self.children= node_type.define(Node.class_type.instance_type)
(if i don’t use optinal() function it gives this error:
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
Cannot infer the type of variable ‘$8build_list.2’ (temporary variable), have imprecise type: list(undefined)<iv=None>.
For Numba to be able to compile a list, the list must have a known and
precise type that can be inferred from the other variables. Whilst sometimes
the type of empty lists can be inferred, this is not always the case, see this
documentation for help:Troubleshooting and tips — Numba 0.50.1 documentation