[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2019-10-17 Thread Guido van Rossum
Guido van Rossum added the comment: See: commit fd97d1f1af910a6222ea12aec42c456b64f9aee4 Author: David Cuthbert Date: Fri Sep 21 18:31:15 2018 bpo-32117: Allow tuple unpacking in return and yield statements (gh-4509) Iterable unpacking is now allowed without parentheses in

[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2019-10-17 Thread Guido van Rossum
Guido van Rossum added the comment: Why is this still open? That feature appears already implemented. -- ___ Python tracker ___

[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2019-10-17 Thread Cheryl Sabella
Change by Cheryl Sabella : -- versions: +Python 3.9 -Python 3.8 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2018-08-28 Thread Guido van Rossum
Guido van Rossum added the comment: > I'm surprised that they are supported in augmented assignments: `a += 1, 2, > 3`. I guess at the time it was felt that it was better to support it everywhere it *could* be supported -- and if a is a list it even makes some amount of sense. In any case

[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2018-08-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I understand why non-parenthesized tuples are supported in assignments, in return statements and yield expressions and in for loops, but I'm surprised that they are supported in augmented assignments: `a += 1, 2, 3`. --

[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2018-08-28 Thread Guido van Rossum
Guido van Rossum added the comment: That's fair. Maybe we shouldn't support `for x in *a, *b:` at all then, until we've got a BDFL decision? (Because once you support it one way you can't easily change the semantics without breaking backwards compatibility.) --

[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2018-08-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > It would need a special case so that `for x in *a, *b:` doesn't first > construct a tuple of all elements in a and b. Thoughts? It may be surprising that `for x in *a, *b:` behave differently from `for x in (*a, *b):`. It is idiomatic to create a list

[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2018-08-28 Thread Guido van Rossum
Guido van Rossum added the comment: I think all of these are good. Perhaps with a small change the for-loop example can allow an elegant way of iterating over multiple iterables. It would need a special case so that `for x in *a, *b:` doesn't first construct a tuple of all elements in a and

[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2018-08-28 Thread Mark Dickinson
Mark Dickinson added the comment: Thanks, Serhiy. I'm happy to extend my PR to cover those cases, if there's general agreement that it's worth doing so. (*I* personally think this is worth doing, since it smooths some currently rough edges and removes a few surprises, but I'm not

[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2018-08-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Other examples: eval('*(1, 2), 3') a = []; a += *(1, 2), 3 for i in *(1, 2), 3: pass def g(): yield *(1, 2), 3 -- nosy: +benjamin.peterson, gvanrossum, serhiy.storchaka ___ Python tracker

[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2018-08-26 Thread Mark Dickinson
Change by Mark Dickinson : -- pull_requests: +8415 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2018-08-26 Thread Mark Dickinson
Change by Mark Dickinson : -- keywords: +patch pull_requests: +8414 stage: -> patch review ___ Python tracker ___ ___

[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2018-08-26 Thread Mark Dickinson
New submission from Mark Dickinson : [From https://stackoverflow.com/q/52026406/270986] The following is valid, and works as expected: >>> def f(): ... x = *(1, 2), 3 ... return x ... >>> f() (1, 2, 3) But the tuple expression can't be used directly in a "return" statement: >>> def