In the middle of the desert you can say anything you want

02 Oct 2023

Python self type

from typing import Self

class Shape:
    def set_scale(self, scale: float) -> Self:
        self.scale = scale
        return self

Related: 220726-1638 Python typing classmethods return type

I remember writing about the typevar approach but cannot find it…

Nel mezzo del deserto posso dire tutto quello che voglio.