Recursive python type annotations in @jitclass

I know that the Numba supports python type annotations in the @jitclass. But is it possible to use python annotation for the recursive types? Here is the code snippet:

from __future__ import annotations

from numba.experimental import jitclass

#@jitclass
class OctNode:
    parent: OctNode
    children: list[OctNode]

    def __init__(self, parent: OctNode = None):
        self.parent = parent
        self.children = None

        def create_children(self):
            self.children = [OctNode(self)] * 8

def main():
    node = OctNode()
    node.create_children()

Hi @alkalinin,

I don’t think this is supported at present. @EPronovost might recall.

There’s an example of self referent @jitclass here numba-examples/linkedlist.py at master · numba/numba-examples · GitHub

Hope this helps?

Thank you for the example, yes, this example works! However I am very impressed how clean the code looks with the support of the native python annotationa. And I want to refactor my tree code and use native python types annotations.