Suggestion. Replace Any with *

Chris Angelico rosuav at gmail.com
Mon Jun 13 13:06:40 EDT 2022


On Tue, 14 Jun 2022 at 01:59, h3ck phy <h3ckphy at gmail.com> wrote:
>
> It would be nice if we could write something like this
> data: dict[str, *] = {}
> instead of
> data: dict[str, Any] = {}
>
> In import statement asterisk means "all names" in a module.
> But in type closure it should mean "all types".

Type hints are normal Python syntax. For this to be legal in a type
hint, it would need to be legal in the rest of Python. What would it
mean?

some_object[other_object, *]

ChrisA


More information about the Python-list mailing list