[Python-ideas] Proposal: Use mypy syntax for function annotations
Łukasz Langa
lukasz at langa.pl
Thu Aug 14 21:35:38 CEST 2014
On Aug 14, 2014, at 12:02 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> Would it be possible, and desirable, to modify the built-in types so
> that we could re-use them in the type annotations?
>
> def word_count(input: list[str]) -> dict[str, int]:
>
>
> Since types are otherwise unlikely to be indexable like that, I think
> that might work.
-1 on that idea. Actually, -1 on List, Dict and friends as well.
Square brackets are for lookup (indexing, key-based, or slicing). Saying here that you’re “looking up” a subtype of list that holds strings is a far stretch.
--
Best regards,
Łukasz Langa
WWW: http://lukasz.langa.pl/
Twitter: @llanga
IRC: ambv on #python-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140814/9750c534/attachment.html>
More information about the Python-ideas
mailing list