In Python, is there any to declare class members of the type being declared?
class Foo:
def __init__(self, a, b):
self.one = a
self.two = b
ZERO = Foo(0, 0)
ONE = Foo(0, 1)
The problem seems to arise from the fact that the class Foo isn’t completely def’d at the time of evaluation for Foo.ZERO and Foo.ONE – is there any way to overcome this while maintaining the form of Foo.MEMBER?
This seems to work: