You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Jason Fried edited this page Feb 12, 2014
·
2 revisions
Pyaib data.Object is a subclass of dictionary but allows for member style access. It has some other nice things to have, that make accessing deep dictionary structures easy.
There is a Case-Insensitive version of the data.Object.
Pathing
You don't need to check for the existence of keys in the object, its very lazy. Deep path checks are not created unless some value is set.
import pyaib.util.data as data
a = data.Object()
print(a) -> {}
x = a.b.c.d.e
print(a) -> {}
x.name = 'stuff'
print(a) -> {'b': {'c': {'d': {'e': {'name': 'stuff'}}}}}
#also
a['b.c.d.e.name'] = 'stuff' # Same as a.b.c.d.e.name = 'stuff'
So keys that contain periods are converted to path to a sub dictionary.
Auto Wrapping
All Dictionary and Lists are wrapped so that when added sub items of them are converted to data.Object's