I still like the approach of doing `import typing as t` - (or other short name of ones preference).
Bcause in the end, any argument used to bring "Any" as a built-in could be used in favor of any other element in typing anway. Typing "t.Any, t.Union, t.Optional" is not a hassle and immediately readable, even by someone who just opened the file and skipped the "import" session. No need for tens of names from "typing.*" to be on the module namespace (or builtins). On Wed, 2 Dec 2020 at 02:41, Christopher Barker <[email protected]> wrote: > They pasted the code / results as screenshots. > > But you got the gist. > > In the future, it's really better to use plain text for email lists. > > -CHB > > > On Tue, Dec 1, 2020 at 9:33 PM Steven D'Aprano <[email protected]> > wrote: > >> On Mon, Nov 30, 2020 at 05:19:13PM +0400, Abdulla Al Kathiri wrote: >> >> > In python 3.9, I get the following error: >> > >> > >> > In python 3.10, I get no runtime errors: >> > >> > >> > >> > >> >> Did you forget to paste the text? Or did gmail eat it? >> >> >> > However, Pylance (I am not sure about mypy) didn’t recognize Any. >> Instead it made it “Unknown”. >> >> That's probably a question for the Pylance devs, but my guess is that >> anything flagged as "Any" type is the same as flagging it as "I don't >> know what that type is". >> >> >> > In fact, I can put anything in 3.10 annotation and it runs just fine. >> > I am not sure if this is the intention of Python3.10 >> >> Yes, Python 3.10 makes the `from __future__ import annotations` >> behaviour occur automatically. See PEP 563: >> >> https://www.python.org/dev/peps/pep-0563/ >> >> (At least, I'm guessing that's what is happening here, it has to be a >> guess because I can't see the code you run and the error you get.) >> >> >> >> -- >> Steve >> _______________________________________________ >> 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/YMJ5NMD3OQOMKWHMMOZAE3WWGHZJD7OY/ >> Code of Conduct: http://python.org/psf/codeofconduct/ >> > > > -- > Christopher Barker, PhD > > Python Language Consulting > - Teaching > - Scientific Software Development > - Desktop GUI and Web Development > - wxPython, numpy, scipy, Cython > _______________________________________________ > 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/UGRPHAKLN2D7CKHNIZYKW2X6OIIJU6QV/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ 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/CITQTZ72VQLDT5DCGLBPSTIPWZMNKLQA/ Code of Conduct: http://python.org/psf/codeofconduct/
