I have a deeply nested object, and throughout my code I often need to manipulate data like this:

```
var current_index = test_dict['current']['index']
var current_section = test_dict['current']['section']
test_dict[current_section]['data']['words'][current_index]

```

So you can see when accessing the object, I'm using variables that reference other parts of the object. This has been working great for me, but throughout my code I also need to periodically update current\_index and current\_section.

Since those variables are only shallow copies/references and not direct shortcuts to those actual values, doing current\_index++ increases current\_index but not test\_dict['current']['index']

In my code test\_dict needs to store all of the current information, so I'm trying to figure out how I can update that dictionary directly without typing out a deeply nested path.

I know I can use dot notation, but that wouldn't save me any time since I would have to do something like:

```
test_dict[test_dict.current.section]['data']['words'][test_dict.current.index]

```

I know I can also create a reference to let current\_index and let current\_section at the beginning of the function, but since I have to manipulate that test\_dict object in almost every function it would be impractical to define it hundreds of times.

Is there a better way? Should I just create a getCurrentIndex() function and then do this?

```
test_dict[getCurrentSection()]['data']['words'][getCurrentIndex()]

```