On Mon, Nov 30, 2020 at 4:27 PM Paul Bryan <[email protected]> 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?


Regards,

-- 
Inada Naoki  <[email protected]>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/2QAWJJK4TWHD2OS7TFXRJCUJK2AF5CR6/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to