[Python-ideas] Re: Shouldn't this: ' myVar: "value" ' be a syntax error ?

2019-07-10 Thread Nick Timkovich
On Tue, Jul 9, 2019 at 4:15 PM Andrew Barnert via Python-ideas < python-ideas@python.org> wrote: > On Jul 9, 2019, at 13:09, Shay Cohen wrote: > > > > >>> a: 3 > > The reason this isn’t a syntax error is that Python allows any valid > expression as an annotation. And “3” is just as valid an

[Python-ideas] Re: Shouldn't this: ' myVar: "value" ' be a syntax error ?

2019-07-09 Thread Andrew Barnert via Python-ideas
On Jul 9, 2019, at 13:09, Shay Cohen wrote: > > >>> a: 3 The reason this isn’t a syntax error is that Python allows any valid expression as an annotation. And “3” is just as valid an expression as “int”. More generally, annotations don’t actually do anything at runtime, except get stored in

[Python-ideas] Re: Shouldn't this: ' myVar: "value" ' be a syntax error ?

2019-07-09 Thread Chris Angelico
On Wed, Jul 10, 2019 at 6:11 AM Shay Cohen wrote: > > > >>> a: 3 > >>> type(a: 3) > File "", line 1 > type(a: 3) > ^ > SyntaxError: invalid syntax > >>> a: 3 > >>> type(a) > Traceback (most recent call last): > File "", line 1, in > NameError: name 'a' is not defined > >>> a >