Q:

Proper way to remove keys in dictionary with None values in Python

What is the proper way to remove keys from a dictionary with value == None in Python?

A:

Generally, you'll create a new dict constructed from filtering the old one.  dictionary comprehensions are great for this sort of thing:
{k: v for k, v in original.items() if v is not None}

If you must update the original dict, you can do it like this ...
filtered = {k: v for k, v in original.items() if v is not None}
original.clear()
original.update(filtered)

This is probably the most "clean" way to remove them in-place that I can think of (it isn't safe to modify a dict while you're iterating over it)

Use original.iteritems() on python2.x

A:

You could also take a copy of the dict to avoid iterating the original dict while altering it.
for k, v in dict(d).items():
    if v is None:
        del d[k]

But that might not be a great idea for larger dictionaries.

A:

For python 2.x:
dict((k, v) for k, v in original.items() if v is not None)

