Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

It's like dict, but better

Project Description

SuperDict - it’s like dict, but better.

You don’t change you dictionary to something new, you just make it better.

Module contains only 15 lines of code and valid by PEP8.

Installation

$ pip install superdict

Usage

>>> from superdict import SuperDict
>>>
>>> data = SuperDict()
>>>
>>> data.so.how.it = 'works'
>>> data
{'so': {'how': {'it': 'works'}}}
>>> data.so
{'how': {'it': 'works'}}
>>>
>>> data.test.me.please = 42
>>> data
{'test': {'me': {'please': 42}}, 'so': {'how': {'it': 'works'}}}
>>>
>>> del data.test.me
>>> data
{'test': {}, 'so': {'how': {'it': 'works'}}}
>>>
>>> data['so']['how']
{'it': 'works'}
>>>
>>> default_data = SuperDict({'default': {'x': 'y'}})
>>> default_data
{'default': {'x': 'y'}}
>>> default_data.default.x
'y'
>>>
>>> default_data = SuperDict({'default': SuperDict({'x': 'y'})})
>>> default_data
{'default': {'x': 'y'}}
>>> default_data.default.x
'y'
>>>
>>> real_dict = SuperDict({'is_success': True})
>>> copied_dict = real_dict.copy()
>>> copied_dict.is_success
True

In another cases this class works like a dict.

>>> default_data['unknown-key']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'unknown-key'
>>>
>>> default_data['set'] = 'correct'
>>> default_data['new-set']['value'] = 'wrong'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'new-set'
Release History

Release History

This version
History Node

1.0.3

History Node

1.0.2

History Node

1.0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
SuperDict-1.0.3.tar.gz (747 Bytes) Copy SHA256 Checksum SHA256 Source Jan 28, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting