[Python-ideas] Trial balloon: adding variable type declarations in support of PEP 484

Alexander Belopolsky alexander.belopolsky at gmail.com
Fri Aug 5 12:38:57 EDT 2016


On Fri, Aug 5, 2016 at 12:23 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> Alternately, for functions
> we could evaluate the annotations in global/non-local scope at the
> time the code object is created (i.e. when handling the MAKE_FUNCTION
> op code), rather than as part of the code object's bytecode.

I had exactly the same thoughts, but I wonder how likely the type
annotations would need local scope.  For example, is something like
this

def f(x):
  v: type(x)
  ...

going to be supported by type checkers?


More information about the Python-ideas mailing list