Skip to content

Commit

Permalink
Merge pull request #103 from mfekadu/master
Browse files Browse the repository at this point in the history
update readme so new reader can instantly get it
  • Loading branch information
mahmoud committed Oct 15, 2019
2 parents 0a3a8a3 + 0519921 commit 1435bd3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,30 @@ Anything you can do at the command line readily translates to Python
code, so you've always got a path forward when complexity starts to
ramp up.


## Examples
#### Without glom
```
>>> data = {'a': {'b': {'c': 'd'}}}
>>> data['a']['b']['c']
'd'
>>> data2 = {'a': {'b': None}}
>>> data2['a']['b']['c']
Traceback (most recent call last):
...
TypeError: 'NoneType' object is not subscriptable
```

#### With glom
```
>>> glom(data, 'a.b.c')
'd'
>>> glom(data2, 'a.b.c')
Traceback (most recent call last):
...
PathAccessError: could not access 'c', index 2 in path Path('a', 'b', 'c'), got error: ...
```

## Learn more

<img width="30%" align="right" src="./docs/_static/comet_multi.png">
Expand Down

0 comments on commit 1435bd3

Please sign in to comment.