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

אלעזר elazarg at gmail.com
Thu Aug 4 03:07:29 EDT 2016


> Date: Wed, 3 Aug 2016 16:53:55 -0700
> From: Guido van Rossum
>
> On Wed, Aug 3, 2016 at 3:02 PM, Pavol Lisy <pavol.lisy at gmail.com> wrote:
>
> > def fnc():
> >   global a: list
>
> I'm not proposing to add such syntax, and the right place for the type
> of a would be at the global level, not on the `global` syatement.
>
If 'a'  is only read, it looks like a sensible way to state that this
function should be called only when 'a'  is a list. It's not the same as a
global type declaration. More like a parameter type hint.

If 'a'  is written to, it is very similar to the 'if else' example.

(which, if I may add, is usually defined as the meet of the assertions. If
we talk about abstract interpretation frameworks)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160804/46e53456/attachment-0001.html>


More information about the Python-ideas mailing list