[Python-ideas] Enhancing dict.values

Steven D'Aprano steve at pearwood.info
Fri May 27 13:42:52 EDT 2016


On Fri, May 27, 2016 at 05:42:44PM +0100, Paul Moore wrote:

> > - Any other functionality?
> 
> Nested unpacking:
> 
> location = = { 'name': 'The north pole', 'position': { 'x': 0, 'y': 0 }}
> location_name, x, y = location.getvalues('name', 'position.x', 'position.y')

How do you distinguish between a key 'position.x' and a key 'position' 
with a dict with a key 'x'?

Nested unpacking seems too Javascripty for my liking.


-- 
Steve


More information about the Python-ideas mailing list