Message306761
| Author |
dacut |
| Recipients |
dacut |
| Date |
2017年11月22日.23:31:49 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1511393509.38.0.213398074469.issue32117@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
This stems from a query on StackOverflow: https://stackoverflow.com/questions/47272460/python-tuple-unpacking-in-return-statement/
Specifically, the following syntax is allowed:
def f():
rest = (4, 5, 6)
t = 1, 2, 3, *rest
While the following result in SyntaxError:
def g():
rest = (4, 5, 6)
return 1, 2, 3, *rest
def h():
rest = (4, 5, 6)
yield 1, 2, 3, *rest
Looking at the original commit that enabled tuple unpacking in assignment statements:
https://github.com/python/cpython/commit/4905e80c3d2f6abb613d212f0313d1dfe09475dc
I don't believe this difference is intentional.
My GitHub repo incorporates a fix for this; I'll file a pull request momentarily. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2017年11月22日 23:31:49 | dacut | set | recipients:
+ dacut |
| 2017年11月22日 23:31:49 | dacut | set | messageid: <1511393509.38.0.213398074469.issue32117@psf.upfronthosting.co.za> |
| 2017年11月22日 23:31:49 | dacut | link | issue32117 messages |
| 2017年11月22日 23:31:49 | dacut | create |
|