On Mon, Nov 30, 2020 at 4:27 PM Paul Bryan email@example.com wrote:
I believe the __future__ import makes any annotation a string, it doesn't make Any magically resolvable later. If you don't import Any into the scope of the annotation, it won't be resolved when getting type hints.
I don't say it works 100% use cases. But when you want to use type checker (mypy, pyre), or code completions (e.g. pylance), it "works". When you need to support typing.get_type_hints, you can still `from typing import Any`.
And we can consider resolving typing.Any (and any other globals) in typing.get_type_hints(), instead of adding Any to builtins.
As Abdulla said, having both `any` and `Any` in builtins makes Python more confusing. If typing.get_type_hints() is the problem, why don't we changing typing.get_type_hints() behavior?