01.10.21 15:01, Matt del Valle пише:
> `any` (for use  instead of `typing.Any`)
> `callable` (for use instead of `typing.Callable`)

The problem is than any() and callable() are not types, but functions,
whose names are accidentally similar to names of some typing types.
If the name of callable() would be iscallable(), you would not even came
with this idea.

Now, if merge any() and typing.Any, callable() and typing.Callable, what
should help() show for any and callable? What are they signatures? How
do you explain that the same object is used for two different,
completely unrelated things?

> Having to explicitly import objects from `typing` for basic type-hinting
> use-cases is a not-inconsiderable source of frustration preventing their
> uptake, especially by beginners. 3.9 made a valuable step forward in
> reducing this friction, but I think we can go further.

In any case you need to import for Mapping, Sequence, Final, NoReturn,
TypeVar, etc. list[int] is not the same as Iterable[int], and using
interfaces and protocols in annotations is more preferable than using
concrete classes.

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/OHOHGJQOBAVLKCMBWFRDNN2E4ZV5L62G/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to