3 ms·
Not GP, but it's _very_ limited. Off the top of my head, things you can't do: # nested unpacking (a, b), c = ((1, 2), 3) # destructuring argument
by OJFord 8y ago
Not GP, but it's _very_ limited.
Off the top of my head, things you can't do:
# nested unpacking
(a, b), c = ((1, 2), 3)
# destructuring arguments
(lambda (a, b): None)((1, 2))
- SirScrambly 8y agoFor your second example, you need to unpack your parameters. (lambda x, y: None)(*(1, 2)) Unless you're saying you should be able to define the set size you pass in.
- OJFord 8y agoYes, it was an example of something you _can't_ do.
- fiddlerwoaroof 8y agoBoth of these were intentionally removed around Python 3, iirc: python 2.7 allows nested tuple/list destructuring as well as destructuring in function arg lists.
- zephyrfalcon 8y agoFirst example works fine in both Python 2 and 3. Second example works in Python 2.7 and earlier, but tuple unpacking for arguments was removed in Python 3. [1] [1] https://www.python.org/dev/peps/pep-3113/ https://www.python.org/dev/peps/pep-3113/