I am maintaining a collection of created objects within class:
class Foo:
all_of_us: = []
def __init__(self):
Foo.all_of_us.append(self)
Which fails if I try to type annotate:
import typing
class Foo:
all_of_us: typing.List[Foo] = []
With NameError: name 'Foo' is not defined
.
What is the right way to go about it?