Get the latest tech news
A Python dict that can report which keys you did not use
Demonstrates a very basic way, in Python, how to know which fields of a dict you never accessed.
This can come in handy if you're working with large Python objects and you want to be certain that you're either unit testing everything you retrieve or certain that all the data you draw from a database is actually used in a report. For example, you might have a SELECT fieldX, fieldY, fieldZ FROM ... SQL query, but in the report you only use fieldX, fieldY in your CSV export. Here's a typed version, by commenter Michael Cook:
Or read this on Hacker News