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
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca1afec6b3d916cbd1680bdb8629ae0a445904edaa2633f7f9300d45eb2d3d9c
|
|
| MD5 |
e5c4a0fd4a6f5be43f5de2a173942b2d
|
|
| BLAKE2b-256 |
f88629ec5c860d9b81370599faa6a839d4024a37aa750406e3447281c38819ed
|
File details
Details for the file dict_unpacking_at_home-1.0.0-py2.py3-none-any.whl.
File metadata
- Download URL: dict_unpacking_at_home-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86de2676a7f9ec6ddb2c9ed75f8b165bcc6464c94f4cc7deed438cf6b626204f
|
|
| MD5 |
27221b58829787310165d596cdfd2eb1
|
|
| BLAKE2b-256 |
2529ab826f350e67e1ee156689e67f94232ca956a4c7d5105fbfb647ed823d3c
|