Skip to content

Commit

Permalink
Example for get()
Browse files Browse the repository at this point in the history
  • Loading branch information
bleudev committed May 28, 2024
1 parent 5b2db39 commit 78c3ee4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions examples/udict.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ d[1] # 2
d[:] # u{'id': 2, 'content': 'hello, world'} (UDict object)
```

You can also use `get()` method.
You can get item by its key using `key` kwarg,
and you can get item by its index using `index` kwarg.
Example:
```python
d = UDict({2: 3, 1: 4})
d[2] # 3
d.get(index=2) # 4
d.get(key=1) # also 4
```

## Set items

For setting items you should use the way you use in lists and dicts:
Expand Down

0 comments on commit 78c3ee4

Please sign in to comment.