[Python-ideas] Enabling / disabling optional type hinting

Ned Batchelder ned at nedbatchelder.com
Sat Mar 23 17:25:57 EDT 2019

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.

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


More information about the Python-ideas mailing list