[Python-Dev] Type hints -- a mediocre programmer's reaction (original) (raw)
Guido van Rossum guido at python.org
Tue Apr 21 01:12:31 CEST 2015
- Previous message (by thread): [Python-Dev] Type hints -- a mediocre programmer's reaction
- Next message (by thread): [Python-Dev] Type hints -- a mediocre programmer's reaction
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Apr 20, 2015 at 2:01 PM, Robert Collins <robertc at robertcollins.net> wrote:
On 21 April 2015 at 08:50, Harry Percival <harry.percival at gmail.com> wrote: >> stub files are only used to type-check users of a module. If you want a >> module itself to be type-checked you have to use inline type hints > > is this a fundamental limitation, or just the current state of tooling?
AIUI its the fundamental design. Stubs don't annotate python code, they are annotated code themselves. They aren't merged with the observed code at all. Could they be? Possibly. I don't know how much work that would be.
It's fundamental in the implementation of mypy. It doesn't have to be in the implementation of other type checkers (and IIRC the Google folks are planning to merge the two streams). However if you are using typing.get_type_hints(func) this is not intended to give you access to hints defined in stubs (it would require a huge amount of machinery to implement that right).
-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150420/e4536d2c/attachment.html>
- Previous message (by thread): [Python-Dev] Type hints -- a mediocre programmer's reaction
- Next message (by thread): [Python-Dev] Type hints -- a mediocre programmer's reaction
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]