Marco Sulla wrote at 2022-4-3 21:17 +0200:
>On Sun, 3 Apr 2022 at 18:57, Dieter Maurer <die...@handshake.de> wrote:
>> You know you can easily implement this yourself -- in your own
>> `dict` subclass.
>
>Well, of course, but the question is if such a method is worth to be
>builtin, in a world imbued with JSON. I suppose your answer is no.
```
def mget(m, *keys):
  """return m[k1][k2]...[kn] or `None`"""
  for k in keys():
    if k not in m: return
    m = m[k]
  return m
```
Thus, it is so simple to get what you want.
No need to make it builtin.

--
Dieter
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to