

def to_pairs(dictlike):
    'Yield (key, value) pairs from any dict-like object.\n\n    Implements an optimized version of the dict.update() definition of\n    "dictlike".\n\n    '
    if hasattr(dictlike, 'iteritems'):
        return key.iteritems()
    elif hasattr(dictlike, 'keys'):
        return ((key, dictlike[key]) for key in dictlike.keys())
    elif hasattr(dictlike, '_asdict'):
        return dictlike._asdict().iteritems()
    else:
        return ((key, value) for (key, value) in dictlike)

dataset/ETHPy150Open jek/flatland/flatland/util/base.py to_pairs/VarMisuse@23/90 `dictlike`->`key`