On Wed, Apr 15, 2020 at 2:59 PM Ivan Pozdeev via Python-Dev python-dev@python.org wrote:
"Glom syntax" still excludes the delimiter, whatever it is, from use in keys. So it's still a further limitation compared to the JSON spec.
Glom does let you be specific about the exact lookup keys if you want, to handle keys that contain embedded periods, or non-string keys. The syntax looks like:
from glom import glom, Path glom(obj, Path("a", "b.c", 2))
https://glom.readthedocs.io/en/latest/api.html#specifier-types
For a simple case like this t's a bit wordier than obj["a"]["b.c"][2], but OTOH you get better error message on failed lookups, null-coalescing support by using default=, etc.
-n