Skip to content

Commit

Permalink
docs: add docs for new features
Browse files Browse the repository at this point in the history
  • Loading branch information
01Joseph-Hwang10 committed Mar 6, 2024
1 parent 22f8f1c commit 4cdd4c9
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,39 +158,9 @@ dot["h.age"]

Full example can be found on [tests/test_dotty_custom_types.py](https://github.com/01Joseph-Hwang10/dotty-dictionary/tree/master/tests/test_dotty_custom_types.py)

## Quick Examples
## More Examples

Create new dotty using factory function.

```py
from dotty_dictionary import dotty
dot = dotty({'plain': {'old': {'python': 'dictionary'}}})
dot['plain.old']
{'python': 'dictionary'}
```

You can start with empty dotty

```py
from dotty_dictionary import dotty
dot = dotty()
dot['very.deeply.nested.thing'] = 'spam'
dot
Dotty(dictionary={'very': {'deeply': {'nested': {'thing': 'spam'}}}}, separator='.', esc_char='\\')

dot['very.deeply.spam'] = 'indeed'
dot
Dotty(dictionary={'very': {'deeply': {'nested': {'thing': 'spam'}, 'spam': 'indeed'}}}, separator='.', esc_char='\\')

del dot['very.deeply.nested']
dot
Dotty(dictionary={'very': {'deeply': {'spam': 'indeed'}}}, separator='.', esc_char='\\')

dot.get('very.not_existing.key')
None
```

More examples can be found in the [examples](https://github.com/01Joseph-Hwang10/dotty-dictionary/tree/master/examples) directory.
More examples can be found in the [examples](https://github.com/01Joseph-Hwang10/dotty-dictionary/tree/master/examples) and [tests](https://github.com/01Joseph-Hwang10/dotty-dictionary/tree/master/tests) directory.

## Contributing

Expand Down

0 comments on commit 4cdd4c9

Please sign in to comment.