I have such a method:
def select_unassigned_variable(self, variables: List[V]) -> Optional(V):
I want this to return something of type V or None in some cases.
But I get such error:
TypeError: Cannot instantiate typing.Optional
What should I change?
You need to use it with brackets instead of parentheses:
def select_unassigned_variable(self, variables: List[V]) -> Optional[V]:
like you did with List.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With