Getting nothing when a key is not present in a Dict

Other than just trying, is there an idiom for returning nothing rather than throwing a KeyError when a key is missing from a Dict.

I’m imagining something like

something(x[y], something_when_y_is_absent)

along the lines of Haskell’s

 fromMaybe something_when_y_is_absent (M.lookup y x)
get(x, y, nothing)
5 Likes