Using type hints on an array function input

Question:

I recently read this post which talks about using an array as a function input, and was just wondering if it was possible to use type hints to hint that the array is meant to be an array of str?

for example:

def sterileInput(options = []) -> str:
                          # ^ I want to hint that this array contains strings
    pass
Asked By: Darcy Power

||

Answers:

You can use the typing module

from typing import List
def sterileInput(options: List[str]) -> str:
    pass
Answered By: Mystic Mickey
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.