Lucas Wiman writes: > > Maps with a known, fixed set of keys are relatively uncommon > > in Python, though. > > This is false in interacting with HTTP services, where frequently you're > working with deserialized JSON dictionaries you expect to be in a precise > format (and fail if not).
It's still true. In Python, if I need those things in variables *frequently*, I write a destructuring function that returns a sequence and use sequence unpacking. If I don't need the values in a particular use case, I use the "a, _, c = second_item_ignorable()" idiom. Or, in a larger or more permanent program, I write a class that is initialized with such a dictionary. If you like this feature, and wish it were in Python, I genuinely wish you good luck getting it in. My point is just that in precisely that use case I wouldn't be passing dictionaries that need destructuring around. I believe that to be the case for most Pythonistas. (Although several have posted in favor of some way to destructure dictionaries, typically those in favor of the status quo don't speak up until it looks like there will be a change.) _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/