[Python-ideas] Unpacking a dict
Michael Selik
michael.selik at gmail.com
Fri May 27 11:19:29 EDT 2016
On Thu, May 26, 2016, 10:46 PM Rob Cliffe <rob.cliffe at btinternet.com> wrote:
> On 26/05/2016 18:51, Steven D'Aprano wrote:
> > On Thu, May 26, 2016 at 04:10:10PM +0200, Michel Desmoulin wrote:
> With tuple and list unpacking
> (a,b) = (1,2)
> the structure of the LHS and RHS mirror each other, making the meaning
> intuitive/obvious.
> Doing the same thing for dicts:
> { 'a' : a, 'b' : b } = { 'a' : 1, 'b' : 2 }
> makes the LHS too verbose to be very useful IMO.
But is it intuitive/obvious? Sounds like you think so.
> All the examples so
> far can be done in other, arguably better, ways.
>
Not for nested destructuring. Maybe my example got lost in the shuffle. No
one replied to it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160527/698a6756/attachment-0001.html>
More information about the Python-ideas
mailing list