Skip to content

This is a dictionary that allows for dot access to members along with basic support for immutability

Notifications You must be signed in to change notification settings

anandtrex/sdict

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://travis-ci.org/IGITUGraz/sdict.svg?branch=master

The sdict

The sdict package contains the classes sdictm and sdict which provide an interface that allows for the use of attribute access syntax to access elements of a recursive dictionary. sdictm is a mutable sdict whose members can be updated. sdict is an immutable version of sdictm

Installation

The following command can be run from the directory containing this file in order to install it:

pip install https://github.com/IGITUGraz/sdict/archive/master.zip

Dependencies

None. Tested on Python 3.5.

Usage

from sdict import sdict, sdictm

d = dict(a=1, b=2, c=dict(d=3))

# sdict is the immutable version
sd = sdict(d)
print(sd.a)  # -> prints 1
print(sd.c.d)  # -> prints 3

# sdictm is the mutable version
sd = sdictm(d)
sd.a = 4  # -> a is now 4

About

This is a dictionary that allows for dot access to members along with basic support for immutability

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published