Skip to main content

can we have dict unpacking in python?

Project description

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]

[^1]: with almost a million downloads per month and 30M+ total

ok how do I use it

  1. pip install dict-unpacking-at-home
  2. add # -*- coding: dict-unpacking-at-home -*- to the top of your file (second line if you have a shebang)
  3. 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dict_unpacking_at_home-1.0.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dict_unpacking_at_home-1.0.0-py2.py3-none-any.whl (4.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file dict_unpacking_at_home-1.0.0.tar.gz.

File metadata

  • Download URL: dict_unpacking_at_home-1.0.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for dict_unpacking_at_home-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ca1afec6b3d916cbd1680bdb8629ae0a445904edaa2633f7f9300d45eb2d3d9c
MD5 e5c4a0fd4a6f5be43f5de2a173942b2d
BLAKE2b-256 f88629ec5c860d9b81370599faa6a839d4024a37aa750406e3447281c38819ed

See more details on using hashes here.

File details

Details for the file dict_unpacking_at_home-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for dict_unpacking_at_home-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 86de2676a7f9ec6ddb2c9ed75f8b165bcc6464c94f4cc7deed438cf6b626204f
MD5 27221b58829787310165d596cdfd2eb1
BLAKE2b-256 2529ab826f350e67e1ee156689e67f94232ca956a4c7d5105fbfb647ed823d3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page