[Python-Dev] Extending tuple unpacking
Steve Holden
steve at holdenweb.com
Thu Oct 13 12:55:52 CEST 2005
Nick Coghlan wrote:
> Ron Adam wrote:
>
>>I wonder if you make '*' work outside of functions arguments lists, if
>>requests to do the same for '**' would follow?
>
>
> Only if keyword unpacking were to be permitted elsewhere first. That is:
>
> Py> data = dict(a=1, b=2, c=3)
> Py> (a, b, c) = **data
> Py> print a, b, c
> (1, 2, 3)
>
> Cheers,
> Nick.
>
This gets too weird, though. What about:
(a, **d) = **data
Should this be equivalent to
a = 1
d = dict(b=2, c=3)
? Basically I suspect we are heading towards the outer limits here.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
More information about the Python-Dev
mailing list