On Sun, 23 May 2021 at 19:41, Todd wrote:
>
> The pytoolz/cytoolz project already has this:
> https://toolz.readthedocs.io/en/latest/api.html#toolz.dicttoolz.get_in
It seems a project that is used by many people. I think that JSON is
so much used that that function could be added to the builtin
The pytoolz/cytoolz project already has this:
https://toolz.readthedocs.io/en/latest/api.html#toolz.dicttoolz.get_in
On Sun, May 23, 2021, 11:44 Chris Angelico wrote:
> On Mon, May 24, 2021 at 1:24 AM MRAB wrote:
> > Also, if the first lookup returns a list or a tuple, and an argument can
> >
On Sun, 23 May 2021 at 17:22, MRAB wrote:
>
> On 2021-05-23 13:37, Marco Sulla wrote:
> > I propose to add a get_deep(*args, default=_sentinel) method to dict.
> >
> > It can accept a single argument, that must be an iterable, or multiple
> > arguments.
> >
> > The first element must be a key of
On Mon, May 24, 2021 at 1:24 AM MRAB wrote:
> Also, if the first lookup returns a list or a tuple, and an argument can
> be an index of that list, would be make sense to add a similar method to
> lists and tuples?
Or, better: make it a stand-alone function, not a method of anything.
Although
On 2021-05-23 13:37, Marco Sulla wrote:
I propose to add a get_deep(*args, default=_sentinel) method to dict.
It can accept a single argument, that must be an iterable, or multiple
arguments.
The first element must be a key of the dict. If there's not a second
element, the value is returned.
On Sun, 23 May 2021 at 15:30, Thomas Grainger 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
seems a bit like https://www.python.org/dev/peps/pep-0505/
eg `d?[1]?[0]`
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org