'Using Type Hints with Brackets [duplicate]

After several hours of chasing this error with an AWS Elastic Beanstalk app (Python 3.8), I learned that I can't use type hints with brackets, as seen below. But I don't understand why.

Per the docs, I see type hints as far back as at least 3.5 (I didn't look back further than this).

Does this have to do with the Python version, or something else?

doesn't work:

def func(x, y:list[str]):
    pass

works:

def func(x, y:list):
    pass


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source