Variable Annotations On A Class
I'm trying to build up an object graph in some code where I'm using type hint on class attributes in Python 3.6. Generally this look like: class MyObject: some_variable: float
Solution 1:
This can be done using forward references. So your code would look like this:
classMyObject:
parent: 'MyObject' = None
Post a Comment for "Variable Annotations On A Class"