well you have `getattr(obj, key, default)` that can achieve something similar, although not through JavaScript's or Kotlin's compact chains:
```
reason = None
while not reason:
reason = getattr(e, 'reason', None)
if not reason:
e = e.__context__
```
