Ist there really no nice way to access nested Dicts in Python (if one of the intermediate Dicts might be None)?


Ended up with some sort of safeget(data, *keys) to return none if one of the Dicts actually turns out to be None.

@RyunoKi Yeah, possible. But not nice if you need to do it a lot of times, you would still need to wrap it on a function.

As far as I know, functions aren't that performant in Python.

Perhaps worth to encapsulate it as a class instead.

This way, you can abstract away the internals.

Melde dich an, um an der Konversation teilzuhaben

Eine Mastodon-Instanz gehostet im Thüringer Wald von FeM e.V.