Dict Unpacking in Python

https://news.ycombinator.com/rss Hits: 17
Summary

mom can we have dict unpacking in python? we have dict-unpacking-at-home please don't use this no seriously. I do not need another joke package of mine to be deemed "critical" to pypi 1 ok how do I use it pip install dict-unpacking-at-home add # -*- coding: dict-unpacking-at-home -*- to the top of your file (second line if you have a shebang) enjoy! # -*- coding: dict-unpacking-at-home -*- dct = { 'greeting' : 'hello' , 'thing' : 'world' } { greeting , thing } = dct print ( greeting , greeting , thing ) # hello hello world # even with nesting! dct = { 'a' : [ 1 , 2 , 3 ]} { 'a' : [ 1 , * rest ]} = dct print ( rest ) # [2, 3] problems the current version breaks line numbers in stacktraces -- the correct-line-numbers branch has a fix. but at what cost. see also please don't use this

First seen: 2025-07-11 23:48

Last seen: 2025-07-12 15:51