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 arne
Recipients arne, emilyemorehouse
Date 2019-09-25.14:20:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569421215.61.0.96035385426.issue38277@roundup.psfhosted.org>
In-reply-to
Content
All code is run on python build from the current 3.8 branch.

The following doesn't work:

  >>> [x for x in 'foo' if y := True]
    File "<stdin>", line 1
      [x for x in 'foo' if y := True]
                             ^
  SyntaxError: invalid syntax

While this does:

  >>> [x for x in 'foo' if (y := True)]
  ['f', 'o', 'o']

Since assignment expressions work without parentheses in normal if-clauses and there being no mention on it explicitly being disallowed, this seems to either be a bug or an oversight in the documentation (with my own opinion, for what it's worth, being that it's a bug).
History
Date User Action Args
2019-09-25 14:20:15arnesetrecipients: + arne, emilyemorehouse
2019-09-25 14:20:15arnesetmessageid: <1569421215.61.0.96035385426.issue38277@roundup.psfhosted.org>
2019-09-25 14:20:15arnelinkissue38277 messages
2019-09-25 14:20:15arnecreate