exaloop / codon

A high-performance, zero-overhead, extensible Python compiler using LLVM
https://docs.exaloop.io/codon
Other
13.96k stars 498 forks source link

`from typing import Self` not supported #507

Open akleemans opened 6 months ago

akleemans commented 6 months ago

When self-referencing inside a class, it is possible in Python to do

from typing import Self

class Node:
    neighbor: Self

Currently, referencing the Node-class directly is different in Python (neighbor: 'Node') and Codon (neighbor: Node) so I thought it would be nice to use Self, so the script could run on both Python and Codon.

Could the typing-mock be extended with Self?

inumanag commented 5 months ago

Oh, we should add this—thanks for the suggestion! Right now you need to use neighbor: Node.