On Sun, 23 May 2021 at 15:30, Thomas Grainger <tagr...@gmail.com> wrote:
>
> seems a bit like https://www.python.org/dev/peps/pep-0505/
>
> eg `d?[1]?[0]`

No, I do not want to suppress the exception, only to have a way to
access a nested object in a complicate dict, for example a dict
generated by a JSON.

In your example,

d = {1: [42]}
d.get_deep(2, 0)
# KeyError: 2
d = None
d.get_deep(1, 0)
# AttributeError: 'NoneType' object has no attribute 'get_deep'


> _______________________________________________
> 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/ZKYLSYU7U673RX6XQLYBSC2HGEAO5NES/
> Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
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/5CPPV3VADIF57Y4PPVZROOHGX45I7U6D/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to