Please read PEP 505 before rehashing this old idea.

On Sat, Jun 27, 2020 at 06:35 Daniel. <danielhi...@gmail.com> wrote:

> When I need to traverse nested dicts, is a common pattern to do
>
> somedict.get('foo', {}).get('bar', {})
>
> But there is no such equivalent for arrays, wouldn't be nice if we can
> follow
>
> somedict.get('foo', {}).get('bar', []).get(10) ... ?
>
> What I do in this case is surround with try/except IndexError and set some
> variable to None, or wrap the try/except block in a function. But this is
> noise in my opinion, I just want to follow the same reasoning that I have
> with dicts:  I'm searching for some path deep nested, and want a default if
> not found.
>
> What do you think?
>
> Regards
>
> --
> “If you're going to try, go all the way. Otherwise, don't even start. ..."
>   Charles Bukowski
> _______________________________________________
> 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/LLK3EQ3QWNDB54SEBKJ4XEV4LXP5HVJS/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-- 
--Guido (mobile)
_______________________________________________
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/L64EPHNKVRFLSBJE53GPQ4JFNVNOPH7U/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to