[Python-ideas] Enabling / disabling optional type hinting
Andre Roberge
andre.roberge at gmail.com
Sat Mar 23 17:41:12 EDT 2019
On Sat, Mar 23, 2019 at 6:26 PM Ned Batchelder <ned at nedbatchelder.com>
wrote:
> On 3/23/19 1:37 PM, Gregory P. Smith wrote:
> > Sure, someone is going to typo and omit the = from a := assignment in
> > 3.8 but the walrus is unlikely to be used outside of an conditional or
> > loop test context so this seems like a made up problem.
>
My original message was referring to someone writing ":" instead of "=" by
mistake -- nothing to do with the walrus assignment, but rather using the
same notation to assign a value to a key as they would when defining a dict.
André Roberge
>
> Walruses aren't allowed as a top-level expression anyway:
>
> Python 3.8.0a2 (default, Feb 25 2019, 17:15:37)
> [Clang 10.0.0 (clang-1000.10.44.4)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> d["answer"] := 42
> File "<stdin>", line 1
> d["answer"] := 42
> ^
> SyntaxError: invalid syntax
>
>
> --Ned.
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190323/5b8138bc/attachment.html>
More information about the Python-ideas
mailing list