On Aug 3, 2004, at 2:44 AM, Dave Cole wrote: > >>> a_list = [1, 2, 3, 4, 5] > >>> a, b, *c = a_list While you're proposing expanding the domain of the * construct of function calling to other parts of python, I'd also like to suggest the following features, to make the ** construct also applicable to the rest of the language. To be read with an 70% wink. (I wouldn't be *un*happy if these were in python, but I am not seriously proposing these features for inclusion): Dict unpacking, parallels current sequence unpacking: >>> d = {'foo': 1, 'bar': 2} >>> {'foo': x, 'bar': y} = d >>> x, y (1, 2) Dict interpolation, similar to sequence interpolation and keyword interpolation in function calls: >>> d = {'foo': 1, 'bar': 2} >>> d2 = {'baz': 3, **d} >>> d2 {'baz': 3, 'foo': 1, 'bar': 2} Combining the two: >>> d = {'foo': 1, 'bar': 2, 'baz': 3} >>> {'foo': x, 'bar': y, **d2} = d >>> x, y, d2 (1, 2, {'baz': 3}) James
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4