[Python-ideas] dictionary unpacking
aaron.watters at gmail.com
Wed Apr 2 17:16:50 CEST 2008
"Facundo Batista" <facundobatista at gmail.com>
>bar, spam = d.multiple("foo", "egg")
->1 because the need is way to rare for new syntax support and because
| bar, spam = [d[k] for k in ("foo", "egg")]
>already does what is wanted in easily understood code.
This is true, but with a fast implementation this
operation is incredibly useful. If we go waaay back
to kjbuckets (the original "set" module circa 1993 or so)
(v1,v2,v3) = D.dump( (k1,k2,k3))
and also the inverse operation
kjDict.undump( (k1,k2,k3), (v1, v2, v3) )
which are extremely useful for packing/unpacking
large data structures.
There are lots of other cool operations which
can be very handy -- transpose, difference, closure...
By the way, I've been delighted to see Python
gradually growing features that kjbuckets provided
more than a decade ago. It's just too bad you
guys can't figure out how to get them all at once
-- Aaron Watters
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas