This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lys.nikolaou
Recipients gvanrossum, lys.nikolaou, pablogsal, terry.reedy
Date 2020-11-16.17:43:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605548608.59.0.339929146872.issue42374@roundup.psfhosted.org>
In-reply-to
Content
While a walrus is valid withing generator expressions in 3.8, it's not in 3.9 and onward.

➜  cpython git:(master) ✗ python3.8           
Python 3.8.6 (default, Oct  3 2020, 16:26:47) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> i = 2
>>> a = [1, 2, 3, 4]
>>> (b := i + j for j in a)
<generator object <genexpr> at 0x7f231e78c740>


➜  cpython git:(master) python3.10              
Python 3.10.0a1+ (heads/master:b580ed1, Oct 19 2020, 15:52:12) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> i = 2
>>> a = [1, 2, 3, 4]
>>> (b := i + j for j in a)
  File "<stdin>", line 1
    (b := i + j for j in a)
                ^
SyntaxError: invalid syntax

This is a regression introduced by the new parser.
History
Date User Action Args
2020-11-16 17:43:28lys.nikolaousetrecipients: + lys.nikolaou, gvanrossum, terry.reedy, pablogsal
2020-11-16 17:43:28lys.nikolaousetmessageid: <1605548608.59.0.339929146872.issue42374@roundup.psfhosted.org>
2020-11-16 17:43:28lys.nikolaoulinkissue42374 messages
2020-11-16 17:43:28lys.nikolaoucreate