Skip to main content

ordered, dynamically-expandable dot-access dictionary

Project description

DotMap is a dot-access dict that

  • is dynamically expandable
  • can be initialized with keys
  • easily initializes from dict
  • easily converts to dict
  • subclasses OrderedDict which is ordered by insertion and subclasses dict
m = DotMap()

# key initialization

# new sub maps are created dynamically
m.people.john.age = 32
m.people.john.job = 'programmer'
m.people.mary.age = 24
m.people.mary.job = 'designer'

# iteration ordered by insertion
for k, v in m.people.items():
        print k, v
print

# easy conversion to dictionary
d = m.toDict()

# easy initialization from dictionary
newMap = DotMap(d)
print newMap

# built-in pprint
newMap.pprint()

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
dotmap-1.0.1.tar.gz (1.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page