[Python-ideas] Dictionary destructing and unpacking.

Paul Moore p.f.moore at gmail.com
Thu Jun 8 03:49:13 EDT 2017
On 8 June 2017 at 08:15, Stephen J. Turnbull
<turnbull.stephen.fw at u.tsukuba.ac.jp> wrote:
> 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.)

The most common use case I find for this is when dealing with JSON (as
someone else pointed out). But that's a definite case of dealing with
data in a format that's "unnatural" for Python (by definition, JSON is
"natural" for JavaScript). While having better support for working
with JSON would be nice, I typically find myself wishing for better
JSON handling libraries (ones that deal better with mappings with
known keys) than for language features. But of course, I could write
such a library myself, if it mattered sufficiently to me - and it
never seems *that* important :-)

Paul


More information about the Python-ideas mailing list