In python, class definitions could depend on each other like this:
# This is not fine
class A():
b = B().do_sth();
def do_sth(self):
pass
class B():
a = A().do_sth();
def do_sth(self):
pass
# This is fine
def FuncA():
b = FuncB()
def FuncB():
a = FuncA()
- Why does clases have this problem, while functions don't?
- Languages like C++ have declarations:
class B
to resolve this kind of dependency, does python have similar constructs?