commit 09c967d1ac1eed5975677131b21a2c6df3ac8800 Author: cymen Date: Tue Dec 5 19:49:09 2023 +0100 type issue diff --git a/something.py b/something.py new file mode 100644 index 0000000..d67432f --- /dev/null +++ b/something.py @@ -0,0 +1,19 @@ +from typing import Self + +class Foo: + def __init__(self, x: int) -> None: + self.x = x + + def combine(self: Self, other: Self) -> Self: + return Foo(self.x + other.x) + + def __repr__(self: Self): + return f"Self {{ x: {self.x} }}" + +def main(): + f = Foo(3) + g = Foo(4) + h = f.combine(g) + print(f"{f=} {g=} {h=}") + +main() \ No newline at end of file