Skip to main content

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'))]
    
  • NoCaseDict

    >>> ncd = NoCaseDict({'examPLE' : 1})
    >>> 'example' in ncd
    True
    

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.2.tar.gz (2.8 kB view details)

Uploaded Source

File details

Details for the file dicts-0.2.tar.gz.

File metadata

  • Download URL: dicts-0.2.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dicts-0.2.tar.gz
Algorithm Hash digest
SHA256 3a9a27b50f63333198b14c5f7fa2354ceb3e8690413861aa355ad50ba5813054
MD5 370bced6ad459a2637933d15e78836c8
BLAKE2b-256 dfcf8dadf9d83f18f1e217e4543ca204185269f492157a8cbfbd808651dd9261

See more details on using hashes here.

Supported by

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