We can use Self as a classattribute, like this:
#[pyclass]
struct Foo {}
#[pymethods]
impl Foo {
#[classattr]
const FOO: Foo = Foo {};
}
.
However, by #975, this is temporally prohibited due to a soundness problem, and thus this code panics.
We should be able to enable this by changing the strategy for initializing tp_dict as suggested by @scalexm in the comment.