For a recursive function we can do:
def f(i): if i<0: return print i f(i-1) f(10)
However is there a way to do the following thing?
class A: # do something some_func(A) # ...
If I understand your question correctly, you should be able to reference class A within class A by putting the type annotation in quotes. This is called forward reference.
class A: # do something def some_func(self, a: 'A') # ...
See ref below
1.4m articles
1.4m replys
5 comments
57.0k users