[issue36637] Restrict syntax for tuple literals with one element
New submission from danijar : A tuple can be created with or without parentheses: a = (1, 2, 3) a = 1, 2, 3 While both are intuitive in this example, omitting the parentheses can lead to hard to find errors when there is only one element: a = (1,) a = 1, The first is clear but the second can easily occur as a typo when the programmer actually just wanted to assign an integer (comma is next to enter on many keyboards). I think ideally, omitting parentheses in the single element case would throw a SyntaxError. On the other hand, I assume that it could be difficult to separate the behavior or tuple creating with an without parentheses, since the parentheses are probably not actually part of the tuple literal. -- components: Interpreter Core messages: 340298 nosy: benjamin.peterson, brett.cannon, danijar, xtreak, yselivanov priority: normal severity: normal status: open title: Restrict syntax for tuple literals with one element ___ Python tracker <https://bugs.python.org/issue36637> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34339] Argument unpacking syntax for lambdas
New submission from danijar : It would be great to support argument unpacking for lambdas. Example: lambda x, (y, z): x + y + z instead of lambda x, y_and_z: x + y_and_z[0] + y_and_z[1] Similar unpacking syntax is available for normal functions: def foo(x, y_and_z): y, z = y_and_z return x + y + z This would greatly increase readability in some cases. -- components: Interpreter Core messages: 323158 nosy: benjamin.peterson, brett.cannon, danijar, yselivanov priority: normal severity: normal status: open title: Argument unpacking syntax for lambdas ___ Python tracker <https://bugs.python.org/issue34339> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34339] Argument unpacking syntax for lambdas
danijar added the comment: Thank you! Closing this. -- resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue34339> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com