Keep Dict Sorted
This package contains the ODict class, which is an ordered dict with the capability to keep the items sorted not only in insertion order, but in any order that can be achieved by sorting. Typically this can be sorted on the keys or on the values, but a general sort key function is also possible.
Documentation
Just a small example, with items sorted on the values:
from keep_dict_sorted import ODict
D = ODict({'a':0, 'c':1, 'b':3, 'd':2}, sortkey='value')
print(D) # {'a': 0, 'c': 1, 'd': 2, 'b': 3}
# now change a value:
D['c'] = 4
print(D) # {'a': 0, 'd': 2, 'b': 3, 'c': 4}
For more: see the docstring of the keep_dict_sorted module and the ODict class.
History
Back in the old times the pyFormex project had its own ordered dict with the capability to sort the items on request. After Python's default dict became ordered, it was dropped from pyFormex as its applications could easily be got with a plane dict and sorting comprehensions. Triggered by a recent discussion on discuss.python.org I grabbed the old source, updated it to Python3, added some more functionality (keeping the items sorted at all times, instead of sorting them on request), and threw the whole thing on PyPi. Enjoy.
License
pyFormex is licensed under the GNU General Public License v3 or later (GPLv3+) and so is this package.
Metadata
Release files for keep-dict-sorted 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| keep-dict-sorted-1.0.tar.gz | 16.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| keep_dict_sorted-1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.9 kB
Release files / keep-dict-sorted-1.0.tar.gz
| Download URL | keep-dict-sorted-1.0.tar.gz |
|---|---|
| Size | 16.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a50a3fb10473a13d6fcf98e99e471f623bb8a188f3a177d0390566c4328617c5
|
|
BLAKE2b-256 checksum How to use checksums |
2f917da0ef96fe3bd47329e9626e43448ae9d1dc70190038696490d460deaa77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Release files / keep_dict_sorted-1.0-py3-none-any.whl
| Download URL | keep_dict_sorted-1.0-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa478c0e47ec7d2f864e3576bf0e84ee4e0ad0ca2409ad8c1b323e2e6d6aec9a
|
|
BLAKE2b-256 checksum How to use checksums |
c412b7ee06d647b7eee2917088980004f294dbaaf390cb085a4677bfa3109e2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Security for keep-dict-sorted 1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.