Reputation: 304
I want to specify types in the function definition such as:
def foo(grid : List[List[str]]) -> int:
return 0
However when I run it in the interpreter (3.7.6), it states ModuleNotFoundError: No module named "List". Does anyone have documentation as to where I can read more about specifying the types of parameters and return values? How would I go about accomplishing this?
Upvotes: 0
Views: 35
Reputation: 21275
It's from the typing
module:
from typing import List
def foo(grid : List[List[str]]) -> int:
return 0
See typing.List
Upvotes: 2