Re: [Python-ideas] Trial balloon: adding variable type declarations in support of PEP 484
4 Aug
2016
4 Aug
'16
3:07 a.m.
Date: Wed, 3 Aug 2016 16:53:55 -0700 From: Guido van Rossum
On Wed, Aug 3, 2016 at 3:02 PM, Pavol Lisy
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)
2819
Age (days ago)
2819
Last active (days ago)
0 comments
1 participants
participants (1)
-
אלעזר