Hey all,

Instead of writing this:

```
try:
    return my_dict[“a”][“b”][“c”][“d”]
except:
    return “some default”
```

Or this
```
return my_dict.get(“a”, {}).get(“b”, {}),get(“c”, {}).get(“d”, “some
default”)
```

I propose we allow for an inline exception handler, like `eor`:
```
return my_dict[“a”][“b”][“c”][“d”] eor “some default”
```

This works very similar to what we already have with `or`, and makes code
much more compact and readable.
-- 
Cheers,
Jonathan
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/DIN5XJ5QYWTKJB7JTWAYWBQN7BRVMPNO/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to