A Python client receives extracted results in a nested dictionary. It must read an optional field that is not always present. Which practice is most appropriate?

Published
  1. Assume every expected key is present in every document
  2. Replace all absent values with a randomly generated amount
  3. Check for the field and handle missing or invalid values explicitly
  4. Execute the returned dictionary as Python source code

Comments — 0