Skip to main content

ordered, dynamically-expandable dot-access dictionary

Project description

DotMap is a dot-access dictionary that

  • is dynamically expandable

  • can be initialized with keys

  • easily initializes from dict

  • easily converts to dict

  • is ordered by insertion

from dotmap import DotMap

m = DotMap()

# 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

# key initialization
m = DotMap(a=1, b=2)

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

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

# built-in pprint
newMap.pprint()

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

dotmap-1.0.7.tar.gz (1.9 kB view details)

Uploaded Source

File details

Details for the file dotmap-1.0.7.tar.gz.

File metadata

  • Download URL: dotmap-1.0.7.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dotmap-1.0.7.tar.gz
Algorithm Hash digest
SHA256 fb9afaf58e8a3cc560bb1887f63bc794f264127d07cfa82d52dd4646a27f2058
MD5 693714122aa03254aba5c300746e2f56
BLAKE2b-256 2ada3b9b76f0fcd27f5d2b346352d123bf33b7e32fd8b7c848b8612523d9e009

See more details on using hashes here.

Supported by

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