Easy use dictionaries with specific features
Project description
All kind of dictionaries you always think but never do.
Instalation
To install dicts form Pypi:
easy_install dicts
or
pip install dicts
if you want to install it from source code:
python setup.py install
Usage
Dictionaries Features
join:
>>> d1 = Dict({1 : 7, 2 : [1,2], 3 : 'a'}) >>> d1.join({1 : 2, 2 : [3], 3 : 'b'}) {1: 9, 2: [1, 2, 3], 3: 'ab'}
Especific dictionaries
KeySortedDict:
>>> ksd = KeySortedDict({'c' : 1, 'a' : 6, 'b' : 5}) >>> ksd.items() [('a', 6), ('b', 5), ('c', 1)] >>> ksd.keys() ['a', 'b', 'c'] >>> ksd.values() [6, 5, 1]
ValueSortedDict
>>> vsd = ValueSortedDict({'c' : 1, 'a' : 6, 'b' : 5}) >>> vsd.items() [('c', 1), ('b', 5), ('a', 6)] >>> vsd.keys() ['c', 'b', 'a'] >>> vsd.values() [1, 5, 6]
SortedDict
>>> sd = SortedDict({'c' : (1,'b'), 'a' : (6,'c'), 'b' : (5,'a')}, key=lambda x: x[1][1]) >>> sd.items() [('b', (5, 'a')), ('c', (1, 'b')), ('a', (6, 'c'))]
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
dicts-0.1.tar.gz
(2.1 kB
view details)
File details
Details for the file dicts-0.1.tar.gz
.
File metadata
- Download URL: dicts-0.1.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67dbd4fb12eac6d515db068ead90759ebc00167f7179c384425810e7e6b4566d |
|
MD5 | b17935e39f465205be00c7cc0f7a8bc2 |
|
BLAKE2b-256 | bd04dca9a312dc798445f07f2e71dd3d620a2a0b6fda8ec2c5be01677fc69d33 |