pynougat
A lightweight type-safe Python utility for safely accessing deeply nested dictionary values.
Overview
Nougat solves the common problem of accessing nested dictionary values without raising KeyError exceptions. It provides high-performance nested dictionary access with a clean, type-safe interface for traversing nested dictionaries, returning a default value when any key in the path doesn't exist. Stop worrying about KeyError exceptions and messy null checks!
from pynougat import nougat
data = {...}
user_city = nougat(data, "user", "profile", "address", "city", default="Unknown")
API Definition
FUNCTIONnougat
High-performance function to access deeply nested values in data structures.
FUNCTIONnougat_cached
Returns a cached function to efficiently retrieve the same path repeatedly