Skip to main content

New answers tagged

0 votes

Is there a way in a class function to return an instance of the class itself?

I had exactly this problem today and found that this works: from __future__ import annotations class a(type): def __init__(self, n): self.n = n def foo() -> a: return a(...
Tony van der Peet's user avatar

Top 50 recent answers are included