
On Wed, Aug 11, 2021 at 2:56 PM Thomas Grainger <tagrain@gmail.com> wrote:
Would: ``` @dataclass class Node: global_node: __class__ | None ```
"Just work" with co_annotations?
This feels too specialized to me. It would be great to also handle forward references to other classes and cyclic references, which are also somewhat common: @dataclass class NodeA: component: NodeB | None @dataclass class NodeB: component: NodeA | None Another, slightly more complex example would be cyclic references within two modules in an import cycle. For example, NodeA and NodeB could be defined in different modules. The common thing is that the dependency cycle can only be fully resolved after we have created both type objects. The import cycle case is probably less common but I've seen it in real-world code. Jukka