[Python-ideas] Unpacking a dict
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.
> Python-ideas mailing list
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas