bpo-32117: Allow tuple unpacking in return and yield statements - #4509
Conversation
|
CLA signed and awaiting review. |
|
CLA reviewed and approved. |
|
I'm going to close and reopen to cause Travis-CI and AppVeyor to rerun the tests. |
gvanrossum
left a comment
There was a problem hiding this comment.
Assuming @dacut is no longer interested in this PR. Jordan Chapman, can you add the test I requested and rebase, then push?
| def g(): f((yield from ())) | ||
| def g(): f((yield from ()), 1) | ||
| # Do not require parenthesis for tuple unpacking | ||
| def g(): rest = 4, 5, 6; yield 1, 2, 3, *rest |
There was a problem hiding this comment.
I would add another test here to validate that this works, e.g. self.assertEqual(list(g()), [(1, 2, 3, 4, 5, 6)]).
There was a problem hiding this comment.
I was tempted to do self.assertEqual(*g(), (1, 2, 3, 4, 5, 6)), but I think we're testing enough unpacking
|
I am. :-) I'll add that test if Jordan doesn't beat me to it. |
|
I've added the test to my fork (https://github.com/jChapman/cpython) and rebased, but I don't have the ability to modify this pull request, so I am unsure how to proceed. |
|
Also, I checked that CLA from @jChapman was received so I'll change those labels. I'll probably wait a day before merging, in case another core dev wants to have a look and/or say. |
|
@gvanrossum Reminder to complete merge (it has now been 4 days) |
|
@brettcannon What's that trello.com link? I get "Card not found". |
|
I touched up the news entry slightly (made sure to thank @dacut and @jChapman 😄 ). If @gvanrossum doesn't merge this by the time I do my next sweep through my Python TODO list then I will. |
|
@gvanrossum the Trello card is for my private board to keep track of my TODO entries; didn't realize it left a comment. :/ |
…onGH-9487) News entry clean up, added to what's new Requested by @gvanrossum in python#4509 https://bugs.python.org/issue32117

This is a fix for issue 32117:
This stems from a query on StackOverflow.
Specifically, the following syntax is allowed:
While the following result in SyntaxError:
Looking at the original commit that enabled tuple unpacking in assignment statements:
4905e80
I don't believe this difference is intentional.
https://bugs.python.org/issue32117