Should I use ‘has_key()’ or ‘in’ on Python dicts?

in is definitely more pythonic.

In fact has_key() was removed in Python 3.x.

Leave a Comment