Dictionary Navigation

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Shazelz

I am trying to make a dictionary to be used as the directory architecture for a fake computer. I would just like to know if there is a way to go through multiple keys of a dictionary with one .get() statement, this is because I would like to have a multilayered structure and I want to do this in the most efficient way possible. What I am asking is would it be possible to do something like this


instead of doing


To restate the question is there a way to go through multiple keys of a dictionary using only one .get() statement?

:bust_in_silhouette: Reply From: Inces

You don’t need any get() at all, just sraight formward reference the keys like this :

yes, but I was asking if I could do that in only a pair of brackets. I’m going to assume that there is no way to do that, thank you for your help.

Shazelz | 2021-12-28 02:09

I tried to use Nodepath to get to nested dictionaries, but it really doesn’t seem to work. Maybe You could dig in deeper into property pathing, maybe it is possible in the end…

You can also always use nodes parenting systems as fake dictionary, this way You will be able to get() all kind of data within one pair of brackets. What I mean is : branched and complicated tree of parent-child relationship of Node, who has their data stored in meta. This way You can succesfully use property pathing get(Node1/Node2/Node3:meta)

Inces | 2021-12-28 07:28