[Python-ideas] Unpacking a dict
Neil Girdhar
mistersheik at gmail.com
Tue Jul 5 15:28:32 EDT 2016
I actually don't think it will be very hard.
On Wednesday, May 25, 2016 at 5:02:52 PM UTC-4, Eric V. Smith wrote:
>
> On 5/25/2016 4:14 PM, Ethan Furman wrote:
> > On 05/25/2016 01:08 PM, Eric V. Smith wrote:
>
> >> x, y = extract(mapping, 'a', 'b')
> >> print(x, y)
> >> 1, 2
> >
> > Let's pretend you wrote:
> >
> > a, b = extract(mapping, 'a', 'b')
> >
> > since that's the way I would almost always be using it.
> >
> > The proposal is this:
> >
> > a, b = **mapping
> >
> > The advantages:
> >
> > - much more readable
> > - less duplication
> >
> > Less duplication might not seem like that big a deal, but it's one of
> > the motivators behind decorations and in-place operators, which are both
> > wins.
>
> I agree that would be a win. That's a lot of compiler magic, though.
>
> Eric.
>
>
> _______________________________________________
> Python-ideas mailing list
> Python... at python.org <javascript:>
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160705/08ce6159/attachment.html>
More information about the Python-ideas
mailing list