4 ms·
something.get('nested', {}).get('blah', {}).get('bloop') works just fine but is mighty ugly. ...which is a hint to use something else in this case. dataclass,
by baq 4y ago
something.get('nested', {}).get('blah', {}).get('bloop')
works just fine but is mighty ugly.
...which is a hint to use something else in this case. dataclass, typed dictionary, deserialize properly, whatever.
- ok_dad 4y agoUltimately there’s some things that are best done with dictionaries, so it would be nice to have a simple tool to do this. Something like ‘x.?y.?z[“something”.?]’ would be nice, where the ? might pass any None through to the end without causing attribute and key errors.