Double underscore access notation
Project description
Library for double underscore access notation
Overscore provides a way to retrieve (and store) multi-dimensional data using a single string with double underscores.
Inspired by Django, the access string can be used as a routine argument or a URL parameter, allowing for complex access within simple contexts:
import overscore data = { "things": { "a": { "b": [ { "1": "yep" } ] } } } overscore.get(data, "things__a__b__0____1") # "yep"
All keys/indexes are separated by double underscores. Extra underscores dictate how to parse that place in the path.
Underscores |
Following |
Meaning |
Example |
Equivalent |
---|---|---|---|---|
2 |
letters and numbers |
key |
a__b |
[“a”][“b”] |
2 |
numbers |
index |
a__1 |
[“a”][1] |
3 |
numbers |
negative index |
a___2 |
[“a”][-2] |
4 |
numbers |
numerical key |
a____3 |
[“a”][“3”] |
5 |
numbers |
neagtive numerical key |
a_____4 |
[“a”][“-4”] |
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
Built Distribution
Hashes for overscore-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e08973f643651a99a3ccf363c6055a4d06706c5339b9af7aef6e037a1c7b8ef1 |
|
MD5 | 903e7bd9bad90a43189180a5fbac344e |
|
BLAKE2b-256 | 3ab22e96484899b667a221433d748a8a6c894cf0d6a8daa47a0a15cfa8e75d6f |