Other than just try
ing, 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)