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 firstname.lastname@example.org 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.
On Tue, Dec 1, 2020 at 9:33 PM Steven D'Aprano email@example.com 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:
(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 -- firstname.lastname@example.org To unsubscribe send an email to email@example.com https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://firstname.lastname@example.org/message/YMJ5NM... Code of Conduct: http://python.org/psf/codeofconduct/
-- Christopher Barker, PhD
Python Language Consulting
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython
Python-ideas mailing list -- email@example.com To unsubscribe send an email to firstname.lastname@example.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://email@example.com/message/UGRPHA... Code of Conduct: http://python.org/psf/codeofconduct/