[Python-ideas] PEP 484 (Type Hints) -- first draft round
ethan at stoneleaf.us
Sat Jan 24 20:04:50 CET 2015
On 01/23/2015 08:40 PM, Guido van Rossum wrote:
> This reminds me -- if you have a "# type: OFF" comment at the top of a module, I presume the type checker still reads
> the rest of the file (at the very least looking for "# type: ON"), and it may still record the presence of things
> defined there, for the benefit of checking that things imported *from* that module at least exist. The way I envisioned
> "# type: OFF" was that the type checker will ignore annotations, essentially assuming that annotations it sees don't
> exist. But when it sees the following in file a.py:
> # type: OFF
> def foo(a):
> return a+1
> and in file b.py there is this:
> from a import foo
> foo(1, 2, 3)
> It might still complain about the foo(1, 2, 3) call in b.py, because it still knows that a.foo() takes exactly one argument.
I think "# type: OFF" should just ignore any existing annotations, but still track things such as function parameters
-- maybe by assigning Any to all paramaters it finds?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: OpenPGP digital signature
More information about the Python-ideas