Skip to content

metagriffin/aadict

Repository files navigation

(Yet Another) Auto-Attribute Dict

An aadict is a python dict sub-class that allows attribute-style access to dict items, e.g. d.foo is equivalent to d['foo']. aadict also provides a few other helpful methods, such as pick and omit methods. Also, an aadict is more call chaining friendly (e.g. methods such as update return self) and is pickle'able.

Project

TL;DR

Install:

Use:

Details

The aadict module provides the following functionality:

aadict

An aadict object is basically identical to a dict object, with the exception that attributes, if not reserved for other purposes, map to the dict's items. For example, if a dict d has an item 'foo', then a request for d.foo will return that item lookup. aadicts also have several helper methods, for example aadict.pick. To fetch the value of an item that has the same name as one of the helper methods you need to reference it by item lookup, i.e. d['pick']. The helper methods are:

About

An auto-attribute dict (and a couple of other useful dict functions).

Resources

License

Stars

Watchers

Forks

Packages

No packages published