Skip to content

Conversation

@tirkarthi
Copy link
Member

@tirkarthi tirkarthi commented Feb 1, 2019

Make parenthesis optional for named expressions used with while statement.

The following used to be a SyntaxError which should be valid according to PEP 572. This PR fixes the same.

while match := pattern.search(f.read()): pass

Feel free to rephrase NEWS entry if needed. I couldn't come up with a good test for an actual program for this case without reading a file or iteration. So I have added a test only to test_parser to make sure this is syntactically valid.

cc : @gvanrossum @emilyemorehouse

https://bugs.python.org/issue35877

@tirkarthi tirkarthi changed the title bpo35877: Make parenthesis optional for named expression in while statement bpo-35877: Make parenthesis optional for named expression in while statement Feb 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants